Testing fastimport: changeset IDs changed unexpectedly

Greg Ward greg-hg at gerg.ca
Thu May 14 16:58:00 CDT 2009


I'm overhauling hg-fastimport to use the convert extension as its
backend, rather than reinventing the wheel.  It's coming along nicely,
but I'm confused by a test failure.  (The hg-fastimport tests are in
the same style as Mercurial's own tests, down to using run-tests.py --
so this should be familiar.)

One of my simpler tests imports this fastimport dump:

"""
# define the contents of file foo.txt in commit :3
blob
mark :1
data 12
hello there

# contents of file ooga in commit :3
blob
mark :2
data 11
ooga booga

# and here is commit :3 itself
commit refs/heads/master
mark :3
author Example <example at example.org> 1200000060 -0400
committer Example <example at example.org> 1200000060 -0400
data 17
initial revision
M 100644 :1 foo.txt
M 100644 :2 ooga
"""

Note how everything that hg uses to compute the changeset ID is
included in the fastimport stream.  Because of that, my test*.out
files include changeset IDs, since they are the same every time the
same stream is fastimported.  Or so I thought.  My test is failing
like this:

 % hg log
-o  changeset:   0:56c9f26e6c12
+o  changeset:   0:9a4b81675bd1
    user:        Example <example at example.org>
    date:        Fri Jan 11 01:21:00 2008 +0400
    files:       foo.txt ooga

The test script runs "hg manifest" and "hg cat" to test the contents
of the changeset, not just the metadata.  And that all matches.

Is there a good reason why the changeset ID would change?  Granted,
I've replaced the entire backend of hg-fastimport, so it's possible
that something is subtly different.  But this test is pure ASCII, so
it can't be encoding.  And I've only ever run it on Unix, so I doubt
line endings are the culprit.  And whitespace stripping of the commit
message is done in localrepo.commitctx(), and I'm pretty sure that
both the old code and the new code goes through commitctx().

More curious than concerned,

Greg


More information about the Mercurial-devel mailing list