Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a new branch, made a lot of changes, how to view list of files changed?

So there was a new branch created where we made some breaking changes to the codebase.

Now we are going to merge, but before that I want to get a list of all the files that were changed in the branch.

How can I get a list of files? I tried:

hg status --change REV

But i'm not sure if that is what I want, since I want all files changed in this branch and not a specific revision in the branch.

BTW, how can I view the revision numbers?

like image 232
codecompleting Avatar asked Jan 19 '12 15:01

codecompleting


People also ask

What happens if you make a change on a branch you don't own?

When you change a file in your work-tree, nothing happens to the copy in the index. It still matches the copy in the commit you chose. You have to run git add to copy the file from the work-tree, to the index.


1 Answers

Try with

$ hg status --rev "branch('your-branch')"

to get the changes between the first and the last changeset on the branch (hg status will implicitly use min(branch('your-branch')) and max(branch('your-branch')) when you give it a range of revisions like this).

Since you'll be merging, you should really look at

$ hg status --rev default:your-branch

to see what is changed between the default branch and your-branch. This shows you the modifications done, and filters out any modifications done on the branch due to merges with default.

This is necessary in case your history looks like this:

your-branch:      x --- o --- o --- o --- o --- o --- y
                 /           /           /
default:  o --- a --- o --- b --- o --- c --- o --- o --- d

where you've already merged default into your branch a couple of times. Merging default into your branch is normal since you want to regularly integrate the latest stuff from that branch to avoid the branches drifting too far away from each other.

But if a new file was introduced on default and later merged up into B, then you don't really want to see that in the hg status output. You will see it if you do

$ hg status --rev a:y

since the file was not present in a, but is present in y. If you do

$ hg status --rev d:y

then you wont see the file in the output, assuming that it's present in both heads.


You write in a comment that you're working Kiln repository. They mean "clone" when they say "branch", but the above can still be adapted for your case. All changesets will be on the default named branch, but that's okay.

Run the following command in your local clone of the "branch" repository:

$ hg bookmark -r tip mybranch

This marks the current tip as the head of mybranch. Then pull all the changesets from the main repository:

$ hg pull https://you.kilnhg.com/Repo/public/Group/Main

You then mark the new tip as the tip of the main repository:

$ hg bookmark -r tip main

You can now run

$ hg status --rev main:mybranch

to see the changes between main and my-branch. If you want to see what you did on the branch itself, the use

$ hg status --rev "::mybranch - ::main"

The ::mybranch part will select changesets that are ancestors of mybranch — this is all your new work, plus old history from before you branched. We remove the old history with - ::main. In older versions of Mercurial, you would use hg log -r -r mybranch:0 -P main.

like image 107
Martin Geisler Avatar answered Jan 02 '23 05:01

Martin Geisler