tags:

views:

99

answers:

2

I've got a repository that has a lot of working code. Another developer on my team went without any updates for a while and then committed about 5 changesets. So, now we have two heads that are nearly two weeks apart. The tip doesn't work, but my changeset does.

I want to see what the differences are between the two repositories without having to merge them (because I'm not sure I want to do that).

+1  A: 

If you have both heads in your repository (remember, you don't actually have to update your working copy with the other developer's head), from the root directory of your working copy:

hg diff -r <your head changeset id> -r <other dev changeset id> .

should work. Of course, you can use hg heads to get the changeset ids, one of which it sounds like could be "tip".

If the above returns too much information, and you just wish to know what files changed, try piping through grep:

hg diff -r <your head id> -r <other dev id> | grep -E '^\+{3} b/'

will probably do the trick.

Andrew
this returns 10,000 lines of changes :(
scottm
Your other developer must have been busy... I'll help a bit here with an edit in just a moment.
Andrew
You can pass `--stat` to `hg diff` as well, to get a change summary.
shambulator
@shambulator any idea what the numbers, + an - signs mean in the diffstat output?
scottm
@scottm it's a relative representation of how much code has been added an how much has been deleted in that file.
Ry4an
+1  A: 

Andrew's answer tells you how to see the differences between the files. This is great when you need all the details. But here is how to directly see the names of the files themselves:

hg status --rev X --rev Y

As you all know, the status command is normally used to see what has changed in the working copy since the last commit, or more accurately, since the working copy's parent revision (see hg parents or look it up in hg glossary if you don't know what that is). However, the status command can also be used to compare other revisions.

This can be used for all sorts of nice things... an example would be for writing release notes where it would be nice to mention any new translations introduced since the last release. For Mercurial itself, I can do:

% hg status --rev 1.6.2 --rev tip i18n
M i18n/da.po
M i18n/it.po
M i18n/pt_BR.po
A i18n/ro.po

to see that the Romanian translation is new and that the Danish, Italian, and Brazilian Portuguese translations have been updated. In this case, my working copy parent revision was the tip, so I could have left out --rev tip.

Martin Geisler