In mercurial, how to see diff between in a merge changeset and one parent without changes from the other parent? -
consider trivial repo:
mkdir temp cd temp hg init echo abc > file1 hg ci -a -m init echo def >> file1 echo hey > file2 hg ci -a -m hg -r0 echo ghi >> file1 echo hey > file3 hg ci -a -m b hg merge hg ci -m merge
during merge, take "ghi" (doesn't matter side).
the dag is:
0 - 2 - 3 \- 1 -/
hg diff -r1:3
shows file1 change , new file3.
hg diff -r2:3
shows new file2. same hg log -p -r3
, hg st --change 3
, because 2 first parent.
my question is: how can see changes between 1 , 3 minus changes in 2, conceptually d(1:3) - d(0:2)
?
i expect see file1 change. hg log -r3 -v
shows "files: file1" (i guess because it's file in change ctx), curiously, hg log -r3 --debug
shows "files+: file2".
if run hg view
(provided bundled hgk
extension) , click on r3, shows file1. can't read tcl/tk code, seems trick in contmergediff
function gets list of files in merge, in somehow omits file2.
fwiw, tortoisehg different of above: clicking on r3 shows "m file1" , "a file2" in file list, shows no actual change in file1. click "other parent" shows "m file1" , "a file3", same "diff -r1:3".
a real world use case this: r1 mine, , r2 colleague's. earlier, colleague reviewed r1 (diff 0:1), didn't merge before asking review of r2. reviewed r2 (diff 0:2), , later did merge. when see diff 1:3, have forget i've ever reviewed r2. if merge diff small, can use hgk. if it's big, need see in vdiff.
(update) there's mergediff extension. if tries , finds work, please add answer.
here's guess (though i'm not sure if want). command
$ hg log --template {files} -r <merge-revision>
lists files, have been changed merge. output used list of files diff command, show changes you're interested in.
applied example, following should show merge did your contributions in revision 1:
$ hg diff -r 1:3 `hg log --template '{files}' -r 3` diff --git a/file1 b/file1 --- a/file1 +++ b/file1 @@ -1,2 +1,2 @@ abc -def +ghi
similarly, command below should show how merge affected colleague's changes in revision 2:
$ hg diff -r 2:3 `hg log --template '{files}' -r 3` # no output, since colleague decided keep *ghi*
Comments
Post a Comment