[issue522] hg st of a merge changeset shows phantom status for backed out files

Stephen Lau mercurial-bugs at selenic.com
Wed Mar 21 19:43:16 CDT 2007


New submission from Stephen Lau <stevel at sun.com>:

A file that has been backed out may show "phantom status" in future merge
changesets.

To reproduce:
$ hg clone -r 3854 ssh://anon@hg.opensolaris.org/hg/scm-migration/onnv-scm
$ cd onnv-scm
$ hg pull -u -r onnv_61 ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate
(should get 93 new changesets)

$ hg merge
$ hg commit
$ hg st --rev 3947:3948 | grep "cmd/sa/Makefile"
M usr/src/cmd/sa/Makefile

but that file hasn't been touched since changeset 3270:
[stevel at donuthole:onnv-scm.merge] 578$ hg log -l 1 usr/src/cmd/sa/Makefile
changeset:   3270:747c64b08dbf
user:        dduvall
date:        Wed Dec 13 17:51:32 2006 -0800
summary:     backout 6451790: needs more work

Attaching the dotindexdot output.
And here's some relevant IRC quotage from myself, brendan and mpm:
(17:08:36) brendan: what about the manifest test for 3947 and 3948?
(17:08:47) stevel: what's the manifest test?
(17:09:10) brendan: hg --debug manifest -r 3947 |grep usr/src/cmd/sa/Makefile
(17:09:13) brendan: and the same for 3948
(17:09:36) stevel: hg manifest: option -r not recognized
(17:09:38) stevel: hrm
(17:09:50) stevel: ah. no -r
(17:09:52) brendan: sorry, no -r
(17:10:00) brendan: (grr)
(17:10:18) stevel: they show different checksums for usr/src/cmd/sa/Makefile
(17:10:58) brendan: hg debugindex on the .i might be interesting too
(17:11:08) brendan: hg debugindex .hg/store/data/usr/src/cmd/sa/_Makefile.i
(17:11:20) brendan: see where the manifest hashes show up in that
(17:12:00) mpm: Ok, I've run the ancestor alg against the dot file and it comes
up with 3851.
(17:12:06) stevel: brendan: http://pastebin.ca/405878
(17:12:16) newpers [n=boo at unaffiliated/newpers] entered the room.
(17:12:26) brendan: stevel: which nodeids are the ones in the manifest tests
(17:12:38) brendan: ah nm
(17:12:40) mpm: stevel: rerun the merge with --debug, please.
(17:13:00) brendan: that's interesting
(17:13:17) mpm: I need to leave for the airport soonish.
(17:13:18) brendan: mpm, what do you make of that last pastebin?
(17:14:02) brendan: 3947 has the Makefile from rev 3270, and 3948 has the one
from 3048
(17:14:17) stevel: mpm: running now
(17:14:18) brendan: aha
(17:14:23) brendan: I suspect those makefiles are the same
(17:14:31) brendan: there was a backout of the one at 3260
(17:14:45) brendan: merge picked the first one that matched
(17:14:46) mpm: Right.
(17:15:10) stevel: mpm: merge --debug output at: http://pastebin.ca/405884
(17:15:31) brendan: not sure why the backout didn't pick the same one
(17:15:55) brendan: oh, different parent
(17:17:44) stevel: yeah, the one at 3260 was backed out in rev 3270
(17:18:05) brendan: looks a bit like a merge screwup then
(17:18:07) mpm: Ok, sa/Makefile isn't mentioned in the merge.
(17:18:24) mpm: So it's probably actually a commit screwup.
(17:19:23) brendan: might repeat that manifest test at 3851
(17:19:41) brendan: see which Makefile was used at the previous merge
(17:20:20) brendan: hmm, manifest at 3854 is going to be rev 1
(17:21:06) stevel: it used 2aa09756b20025428945dafdcc6034bd2b0d05ae
(17:21:06) brendan: stevel: can you get the manifest hashes at 3851 and 3854?
(17:21:16) brendan: which, 3854?
(17:21:57) stevel: http://pastebin.ca/405888
(17:22:20) mpm: That's weird.
(17:22:21) stevel: no, that was for 3851.  3854 is the 272f71af09db one
(17:22:34) brendan: wow, that's mindbending
(17:22:57) mpm: Well 3852 is a merge of 3851 and...
(17:23:05) mpm: 3774.
(17:23:22) brendan: arg, I keep making off-by-ones
(17:23:56) mpm: I think if we were to hg cat the file at revs 3851, 3854 and
3948, they'd all be the same.
(17:24:23) mpm: The only difference is, the backout has thrown a loop in their
ancestry.
(17:25:00) stevel: they *should* be the same. the last putback affecting them
was 3270
(17:25:01) mpm: A backout was done one one branch. On the other branch, the file
was never changed.
(17:25:22) stevel: (and yes, they are all the same)
(17:25:24) mpm: So the files in both branches are the same, but one has two more
revs of history.
(17:25:31) brendan: why doesn't merge see that the file revisions are different,
even if the test isn't?
(17:26:09) mpm: Depending which branch is "local" when a merge is done, the
merge will "prefer" that revision of the file.
(17:26:52) codemac [n=codemac at archlinux/developer/codemac] entered the room.
(17:27:33) mpm: Good question.
(17:29:19) mpm: We short-circuit file-level merge when the file contents are the
same.
(17:29:37) mpm: But I would have expected it to have been reported in the
--debug output..
(17:29:40) brendan: yeah.
(17:30:36) brendan: actually it looks like it isn't reported in debug
(17:30:46) brendan: it only mentions when it's going to take an action
(17:31:28) mpm: So it decides to keep its newer version?
(17:32:22) brendan: I guess it keeps p1's
(17:32:45) brendan: I'm now suspecting the issue might be in update :)
(17:32:55) mpm: I thought p1 was 3854 here? That should be 272f..
(17:33:25) stevel: merge? no! commit? no! update? ;-)
(17:33:28) brendan: ah right. weird
(17:33:28) mpm: Well I think we've figured out the 'issue' is a phantom?
(17:33:36) brendan: yeah, it's harmless.
(17:33:41) brendan: just odd.
(17:33:50) stevel: yeah, the correctness of the file contents is fine
(17:34:14) mpm: It's less than ideal.
(17:34:15) stevel: we just happened to notice it and thought it was odd and
wanted to make sure it wasn't symptomatic of anything more dangerous
(17:34:38) brendan: It probably should use p1's version in that case. I don't
know how p2's got in there
(17:34:48) stevel: and anyway, if it wasn't already known - then it might be a bug
(17:35:06) mpm: It's probably the commit logic preferring to think it was the p2
version.
(17:35:52) brendan: why would commit see it?
(17:36:27) mpm: Well, when there's a merge, commit has to figure out which
parent is responsible for the file.
(17:36:29) brendan: I would have guessed the dirstate got p2 at some point
(17:36:44) brendan: ah
(17:36:47) mpm: Dirstate doesn't record the file hashes.
(17:36:51) brendan: oh right
(17:37:51) mpm: Ok, gotta run.
(17:37:56) brendan: bye
(17:38:29) stevel: thanks for the debugging help
(17:42:19) brendan: looks like it's in filecommit, ~700
(17:42:33) stevel: brendan: do you need me to file a bug?
(17:43:46) brendan: probably a good idea.
(17:43:59) brendan: I'm not going to touch that merge logic - it's too deep for me

----------
files: merge.dot
messages: 2924
nosy: stevel
priority: bug
status: unread
title: hg st of a merge changeset shows phantom status for backed out files

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue522>
____________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: merge.dot
Type: application/octet-stream
Size: 53176 bytes
Desc: not available
Url : http://www.selenic.com/pipermail/mercurial-devel/attachments/20070322/ac4b6380/merge-0001.obj


More information about the Mercurial-devel mailing list