When using the convert extension to convert Hg to Hg and using filemap to rename all files results in closed branches being lost during conversion. Steps to reproduce: $ echo "rename . test" > filemap $ hg init close $ cd close $ touch a $ hg add a $ hg commit -m "Initial" $ hg branch close $ echo 1 >> a $ hg commit -m "Branched" $ hg commit --close-branch -m "Closing branch" $ hg up default $ echo 2 >> a $ hg commit -m "2" $ cd .. $ hg convert --filemap filemap close The initial repository has 4 commits, the converted repos only 3. I believe this is an urgent bug because it causes a silent data loss.
I've just run through these steps again and confirmed that this is still happening on version 1.5.4+48-3f1409082720 To summarise: close repo: close-hg repo: changeset: 3:ca7253831af9 -> 2:117322c80c3b changeset: 2:e8459779a04d -> missing changeset: 1:207dde32e9fd -> 1:0929b4237156 changeset: 0:82a64b6b15fa -> 0:b3ec3982febe The hg log of the close repo is: ---------------------------------------- changeset: 3:ca7253831af9 tag: tip parent: 0:82a64b6b15fa user: Mark Booth <mercurial@anang.com> date: Wed Jun 09 16:23:24 2010 +0100 summary: 2 changeset: 2:e8459779a04d branch: close user: Mark Booth <mercurial@anang.com> date: Wed Jun 09 16:22:59 2010 +0100 summary: Closing branch changeset: 1:207dde32e9fd branch: close user: Mark Booth <mercurial@anang.com> date: Wed Jun 09 16:22:38 2010 +0100 summary: Branched changeset: 0:82a64b6b15fa user: Mark Booth <mercurial@anang.com> date: Wed Jun 09 16:22:02 2010 +0100 summary: Initial ---------------------------------------- But the hg log of the close-hg repo is: ---------------------------------------- changeset: 2:117322c80c3b tag: tip parent: 0:b3ec3982febe user: Mark Booth <mercurial@anang.com> date: Wed Jun 09 16:23:24 2010 +0100 summary: 2 changeset: 1:0929b4237156 branch: close user: Mark Booth <mercurial@anang.com> date: Wed Jun 09 16:22:38 2010 +0100 summary: Branched changeset: 0:b3ec3982febe user: Mark Booth <mercurial@anang.com> date: Wed Jun 09 16:22:02 2010 +0100 summary: Initial ----------------------------------------
Possible fix: diff -r 817258259bc9 hgext/convert/filemap.py --- a/hgext/convert/filemap.py Thu Jul 22 08:24:56 2010 -0500 +++ b/hgext/convert/filemap.py Fri Jul 23 15:52:03 2010 -0500 @@ -298,7 +298,9 @@ self.origparents[rev] = parents - if len(mparents) < 2 and not self.wanted(rev, wp): + closed = 'close' in self.commits[rev].extra + + if len(mparents) < 2 and not closed and not self.wanted(rev, wp): # We don't want this revision. # Update our state and tell the convert process to map this # revision to the same revision its parent as mapped to. diff -r 817258259bc9 hgext/convert/hg.py --- a/hgext/convert/hg.py Thu Jul 22 08:24:56 2010 -0500 +++ b/hgext/convert/hg.py Fri Jul 23 15:52:03 2010 -0500 @@ -175,7 +175,8 @@ if self.filemapmode and nparents == 1: man = self.repo.manifest mnode = self.repo.changelog.read(bin(p2))[0] - if not man.cmp(m1node, man.revision(mnode)): + closed = 'close' in commit.extra + if not closed and not man.cmp(m1node, man.revision(mnode)): self.ui.status(_("filtering out empty revision\n")) self.repo.rollback() return parent
Another version of the fix was pushed two months ago: http://hg.intevation.org/mercurial/crew/rev/a2f11188e2d2
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:09 EDT --- This bug was previously known as _bug_ 2185 at http://mercurial.selenic.com/bts/issue2185 Imported an attachment (id=1381)