开发者

How can I see a list of all files that are different between two Hg repositories?

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 d开发者_如何学Coes.

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).


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜