Search code examples
mercurialdifftortoisehg

Hg: how to get diff of two different files?


I'm sorry if it's odd question. I have a mercurial repository. Is it possible to get a diff of two different files from some revision by hg? For example, there is a revision

revision xxx
    - file1
    - file2

How I can get a diff of file1 and file2 by standard hg command or any extensions?

Thank you.

UPD I would like something like this:

hg diff -r xxx file1 file2

Than I will have all changes between two files of same revision.


Solution

  • Initially I read your question differently, but your comment made clear that you are asking about the differences between two files of the same revision. That's nothing where the VCS has any stakes in.

    You simply can use (on *nix systems) the diff command:

    diff FILE1 FILE2
    

    If you need the difference of the files at particular revisions, of course you can use mercurial before that in order to get to that:

    hg update -rXXX
    

    or even to see the difference of FILE1 at revision XXX compared to FILE2 at revision YYY (but beware, it changes the working dir content; make sure to undo the revert afterwards):

    hg revert -rXXX FILE1
    hg revert -rYYY FILE2
    diff FILE1 FILE2