TortoiseHg files shown in merge

I write code to analyze our Hg , and compare the results with TortoiseHg . I am having trouble understanding the behavior of TortoiseHg in case of a merge.

When I select the merge change set in TortoiseHg , the list of affected files shows only those files that had conflicts, unless I click the "Show All" button. At the very least, it looks like an intention based on what I can glean from the Internet, and from observing that the files shown on the list have a bi-directional arrow if I click the Show All button.

I try to imitate this by distinguishing each file in the change set for both parents and including only the file in my analysis if it is different from both parents. However, I come across files that TortoiseHg shows in the merge description, but which differ from only one parent. I also see that in TortoiseHg - the difference from the parent 1 or 2 shows the change, but the other parent does not.

I also tried to distinguish --git with the --git option to make sure that this is not a metadata change that I am missing, but that does not change the results at all.

To get information about a set of changes, I use:

 hg log -v -r <rev> --removed --style xml 

I take parents from a set of merge changes, and for each file in the merge do

 hg diff -r <parent1> -r <rev> filename hg diff -r <parent2> -r <rev< filename 

And I found that the TortoiseHg files show in the merge report summary, which I report as merged without conflicts.

Can anyone shed light on the discrepancy?

Update: I was able to reproduce this with the source code for TortoiseHg itself.

Clone from https://hg01.codeplex.com/tortoisehg Open the repo in tortoiseHg and select rev 12602 (58eb7c70). This merger with parents is 12599 (6c716caa) and 12601 (39c95a81).

TortoiseHg shows the tortoisehg / hgqt / repowidget.py file as the only conflicting file in the merge, but

 hg diff -r 12599 -r 12602 tortoisehg/hgqt/repowidget.py 

returns nothing, but

 hg diff -r 12601 -r 12602 tortoisehg/hgqt/repowidget.py 

displays two lines.

+4
source share
2 answers

I think I understood what tortoise logic is here (although I did not check the source to be sure).

As you may have guessed, the turtle shows files modified on both sides of a double arrow merge. However, this does not just look at the difference of merging with each of his parents (for example, p1(58eb7c70)::58eb7c70 and p2(58eb7c70)::58eb7c70 ). Instead, the turtle finds all the changes made to the merger, comparing the last common ancestor of the two parents.

Take tortoise retouches as an example. Graphical representation of the ancestor 58eb7c70:

 Jonathan:tortoisehg $ hg log --graph -r ::58eb7c70 -l 5 --template "{node|short}\n{desc|firstline}\n\n" o 58eb7c70d501 |\ Merge with stable (noop) | | | o 39c95a813105 | | repowidget: show all errors on infobar | | | o da7ff15b4b96 | | repowidget: limit infobar error messages to 2 lines of up to 140 chars by default | | o | 6c716caa11fd |\| Merge with stable | | | o 48c055ad634f | | sync: show non-ascii command-line arguments correctly | | 

As you can see, merge 58eb7c70d501 merged two development branches with one set of changes (p1, 6c716caa11fd) on one side and two on the other (p2, 39c95a813105 and its parent, da7ff15b4b96). The point at which these branches diverge is the last common ancestor of p1 and p2 - 48c055ad634f.

(The last common ancestor can be found directly using hg log -r "last(ancestor(p1(58eb7c70), p2(58eb7c70)))" )

Let's look at the changes that were made on these two branches. We compare each merge parent with a common ancestor:

 Jonathan:tortoisehg $ hg status --rev "48c055ad634f::6c716caa11fd" M .hgtags M tortoisehg/hgqt/commit.py M tortoisehg/hgqt/compress.py M tortoisehg/hgqt/hgemail.py M tortoisehg/hgqt/postreview.py M tortoisehg/hgqt/purge.py M tortoisehg/hgqt/rename.py M tortoisehg/hgqt/repowidget.py M tortoisehg/hgqt/revset.py M tortoisehg/hgqt/run.py M tortoisehg/hgqt/settings.py M tortoisehg/hgqt/status.py M tortoisehg/hgqt/sync.py M tortoisehg/hgqt/visdiff.py M tortoisehg/util/cachethg.py M tortoisehg/util/hglib.py Jonathan:tortoisehg $ hg status --rev "48c055ad634f::39c95a813105" M tortoisehg/hgqt/repowidget.py 

These are the changes that were actually merged by 58eb7c70d501 - everything changed on the two branches, since they diverged. As you can see, the only file common to lists — the only file that has been modified in both branches — is tortoisehg/hgqt/repowidget.py , as expected. You will see that this file was modified in da7ff15b4b96, one set of changes that is not a merge parent, but is still included in the changes merged with two branches.

+2
source

tortoisehg/hgqt/repowidget.py been changed to 6c716caa11fd , which explains why your second call to hg diff gives you results; the first call compares two revisions for which no changes were registered at tortoisehg/hgqt/repowidget.py ; it seems to me that this sounds to me if I don't miss something else about how hg diff behaves.

0
source

All Articles