hg convert changes a revision's node ID for an unknown reason

Augie Fackler durin42 at gmail.com
Tue Jun 28 23:03:29 CDT 2011

On Jun 27, 2011, at 4:11 PM, Matt Mackall wrote:
> On Mon, 2011-06-27 at 19:44 +0000, Haszlakiewicz, Eric wrote:
>>> -----Original Message-----
>>> From: mercurial-bounces at selenic.com [mailto:mercurial-
>>> bounces at selenic.com] On Behalf Of Peter Hosey
>>> On Jun 25, 2011, at 20:22:34, Augie Fackler wrote:
>>>> There's also another potential wrinkle: convert stores source
>>> information in extra, which will necessarily change all the hashes.
>>> That's what I thought, but the hashes are unchanged up to r182. And the
>>> extra information would be shown in hg log --verbose, wouldn't it? It's
>>> not there in the output I showed for both r183s.
>> I've run into this problem several times before.  If your repository was originally created with old versions of mercurial then some of the metadata can end up in a different order.  In my case, it happen to be that the "copyrev" info for files that had been moved ended up at a different line in mercurial's internal data format.
>> Tracking down the exact difference is a bit more difficult than just what Matt said:
>>> hg debugdata .hg/store/00changelog.i <rev>
>> You actually need to start with that, then use the first line of that output to grab the individual file entries from the manifest:
> ..unless the manifest hashes agree, which I think we've already
> established.

Manifest hashes don't agree, actually. Peter meant the sha1 of the checked out file (I think).

Summary: situation normal, move along.

I hunted this down because Peter was worried. Here's what changed, with steps in the investigation for those curious how I figured it out:
augie% hg debugdata -c 183 -R growl-development-cryptoencumbered | head -n 1
augie% hg debugdata -c 183 -R growl-sanitized | head -n 1
augie% hg debugdata -m 4810ba30660a5a5e3298c3518bd84c7b4c9594a2 -R growl-development-cryptoencumbered > m1
augie% hg debugdata -m 156558bcfa7bbddcf173cea624f353f47ba781536 -R growl-sanitized > m2
augie% diff --text -u m1 m2
--- m1	2011-06-28 22:59:36.000000000 -0500
+++ m2	2011-06-28 22:59:59.000000000 -0500
@@ -111,7 +111,7 @@
augie% hg debugdata growl-development-cryptoencumbered/.hg/store/data/images/icons/whistle.psd.i e04eceadabf3b1491fea898af388459edf2b301e > debugdata-one.dat
augie% hg debugdata growl-sanitized/.hg/store/data/images/icons/whistle.psd.i 7104eb94018e9d61218015b05a0416071f5025bb > debugdata-two.dat
augie% diff --text -u debugdata-one.dat debugdata-two.dat
--- debugdata-one.dat	2011-06-28 22:53:54.000000000 -0500
+++ debugdata-two.dat	2011-06-28 22:54:06.000000000 -0500
@@ -1,6 +1,6 @@
-copyrev: 243f3bf7b7833d5ddd5aba57c24ccbda3cf5f707
 copy: Examples/whistle.psd
+copyrev: 243f3bf7b7833d5ddd5aba57c24ccbda3cf5f707
[elided binary cruft]

That is, we're now sorting metadata fields lexicographically instead of by Python's dict order so node shas are stable across Python implementations (as I recall that's why the change was made). Nothing to worry about here.

More information about the Mercurial mailing list