I am trying to view the differences between two versions of a project. The way I initially thought to do it:
hg diff
the two versions This did not work, because when the second version overwrote the first version Mercurial assumed every single file was changed. In reality only a few files are changed, and I want to see what specifically was changed in each file.
WinDiff gives me a list of the files that were changed but that is it, so I would really like to use Hg to get the specifics.
EDIT: I am using Eclipse. What I specifically am doing is creating a new Java project, using Eclipse's import feature to import the source files I want, and then commit that project to my repository. I then use import again to import version 2 into the same project so that the files from the first are overwritten. I am left with files that are named the same but that are version 2 files. I then commit the new files to the repository.
My Mercurial version is 1.8.3. Doing the steps above gives me just one changeset.
Also, when creating the diff is there a way to specify to only diff Java files, not text or properties, etc.?
Your procedure is sound, just remember to use hg addremove
like Lasse pointed out in the comments. So the full procedure is:
hg add
and hg commit
.hg
hg addremove
and hg commit
hg diff
the two versions The hg addremove
step will even detect files that have been renamed between the two versions. You also write:
Also, when creating the diff is there a way to specify to only diff java files, not text or properties, etc.?
Yes, you can use the --include
flag for this:
$ hg diff -I '**.java'
I don't get it why your can't directly use Mercurial on the original repository of your project.
To see what are the changes to Java files between REV1 and REV2 of your project:
hg diff -r REV1 -r REV2 -I **.java
To diff two versions of a file in eclipse:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.