Bug 2900 - hg convert corrupts repository
Summary: hg convert corrupts repository
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: convert (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-13 09:55 UTC by cowwoc2020
Modified: 2016-02-23 12:58 UTC (History)
9 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cowwoc2020 2011-07-13 09:55 UTC
I've used "hg convert" for months with no problem but I just noticed a
specific case where it seems to corrupt repositories.

Using Mercurial 1.9+10-e9264b45237d

"hg verify" on the original repository returns:

checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
183 files, 43 changesets, 436 total revisions


I invoke "hg convert --authormap authors.txt jperipheral jperipheral.new".
This completes without any warnings or errors.

"hg verify" on the new repository returns:

checking changesets
checking manifests
crosschecking files in changesets and manifests
 0: changeset refers to unknown manifest 000000000000
checking files
183 files, 43 changesets, 436 total revisions
1 integrity errors encountered!
(first damaged changeset appears to be 0)

The first changeset is pretty big (15MB). The entire repository is around
40MB. Please let me know what I can do to help you reproduce this bug. Are
there any extra logs I can enable?
Comment 1 cowwoc2020 2011-07-13 09:58 UTC
Correction, the entire .hg directory is 16MB.
Comment 2 cowwoc2020 2011-07-13 10:06 UTC
The authormap is not relevant. Invoking "hg convert jperipheral
jperipheral.new" is enough to corrupt the repository.
Comment 3 cowwoc2020 2011-07-13 10:10 UTC
I've posted a copy of the repository here:
http://hotfile.com/dl/123953371/b30f9d9/jperipheral.zip.html

Please let me know when you're done downloading it so I can delete it.
Comment 4 Augie Fackler 2011-07-13 10:16 UTC
I've got the repository and can reproduce. Feel free to take that link down,
I can share this with other hg devs as-needed if someone else beats me to this.
Comment 5 Augie Fackler 2011-07-13 10:17 UTC
I suspect this is related to the first revision having no files, and our
manifest-reuse code.
Comment 6 Matt Mackall 2011-07-13 10:50 UTC
This is harmless and is a bug in verify. The 00000000 revision (aka the
empty revision) is implicitly present in all revlogs. Degrading to bug.

$ hg init a
$ cd a
$ hg branch foo   # make a nearly-empty commit
marked working directory as branch foo
$ hg ci -Am0
$ echo b > b
$ hg ci -Am1

$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
 0: changeset refers to unknown manifest 000000000000
checking files
1 files, 2 changesets, 1 total revisions
1 integrity errors encountered!
(first damaged changeset appears to be 0)
Comment 7 cowwoc2020 2011-07-13 10:56 UTC
Matt,

Just curious, why then does "hg verify" work on the original repository?
Comment 8 Matt Mackall 2011-07-13 10:59 UTC
Not sure. Does hg log -vr 0 report no files in the original?
Comment 9 Augie Fackler 2011-07-13 11:00 UTC
Yes, because it's a conversion from svn.
Comment 10 cowwoc2020 2011-07-13 12:29 UTC
Unless I've missed something, you haven't answered my question as to why "hg
verify" works on the original repository. Yes, the converted repository is a
conversion from SVN, but so is the original.
Comment 11 Matt Mackall 2011-07-13 12:43 UTC
Again, does hg log -vr 0 report no files in the original?

There are multiple ways to represent "the empty manifest with no parents".
One is with the null revision, which is what convert produced. Your source
repository managed to use another. Unless the -contents- of the conversion
are wrong, the question is purely academic.
Comment 12 cowwoc2020 2011-07-13 12:44 UTC
Okay, I understand. Thanks Matt.
Comment 13 HG Bot 2011-07-13 16:00 UTC
Fixed by http://selenic.com/repo/hg/rev/eb914541a950
Matt Mackall <mpm@selenic.com>
verify: filter messages about missing null manifests (issue2900)

(please test the fix)
Comment 14 HG Bot 2011-07-13 19:00 UTC
Fixed by http://selenic.com/repo/hg/rev/15afa4984a94
Matt Mackall <mpm@selenic.com>
verify: filter messages about missing null manifests (issue2900)

(please test the fix)
Comment 15 Paul Nathan 2011-09-21 13:01 UTC
I tested verify with a pull from today of hg. It still returns an error when 
a 0-length manifest is encountered. 

version 1.9.2+73-ff26712a0c50


paulnath@paulnathlinux:~/temp/empty-repo-issues
$ ~/hg/hg init
paulnath@paulnathlinux:~/temp/empty-repo-issues
$ ~/hg/hg branch release
marked working directory as branch release
paulnath@paulnathlinux:~/temp/empty-repo-issues
$ ~/hg/hg commit -m "new branch"
paulnath@paulnathlinux:~/temp/empty-repo-issues
$ ~/hg/hg verify
checking changesets
checking manifests
 0: empty or missing manifest
crosschecking files in changesets and manifests
checking files
0 files, 1 changesets, 0 total revisions
1 integrity errors encountered!
(first damaged changeset appears to be 0)
paulnath@paulnathlinux:~/temp/empty-repo-issues
$ ~/hg/hg version
Mercurial Distributed SCM (version 1.9.2+73-ff26712a0c50)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2011 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 16 Augie Fackler 2011-09-21 13:03 UTC
Yeah, I've known about that, but haven't had a chance to bug mpm about it in
irc.
Comment 17 Matt Mackall 2011-09-21 13:10 UTC
Yes, that portion of the bug still exists, but only for trivial repos that
contain no files at all.
Comment 18 Bugzilla 2012-05-12 09:21 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:21 EDT  ---

This bug was previously known as _bug_ 2900 at http://mercurial.selenic.com/bts/issue2900
Comment 19 Matt Mackall 2014-07-25 17:22 UTC
Bulk close: no activity for >2 years -> WONTFIX
Comment 20 Matt Mackall 2014-07-31 13:23 UTC
Bulk change recent WONTFIX -> new, more descriptive ARCHIVED state (sorry for the spam)
Comment 21 HG Bot 2016-02-22 15:32 UTC
Fixed by https://selenic.com/repo/hg/rev/334a3aa677fb
Martin von Zweigbergk <martinvonz@google.com>
verify: drop unnecessary check for nullid

In eb914541a950 (verify: filter messages about missing null manifests
(issue2900), 2011-07-13), we started ignoring nullid in the list of
manifest nodeids to check. Then, in b32a30da608d (verify: do not choke
on valid changelog without manifest, 2012-08-21), we stopped adding
nullid to the list to start with. So let's drop the left-over check
now.

(please test the fix)
Comment 22 cowwoc2020 2016-02-23 09:10 UTC
Who are we expecting to test the fix?
Does anyone still have a copy of the testcase?
Comment 23 Pierre-Yves David 2016-02-23 09:28 UTC
If you could test it this would be great.
Comment 24 cowwoc2020 2016-02-23 09:32 UTC
I tested version 3.7.1 and it works fine. Is this the correct version to be testing?
Comment 25 Matt Mackall 2016-02-23 12:58 UTC
Ignore this, this is just the BTS robot noting a stray mention of an ancient issue number in a much later cleanup.