# HG changeset patch # User Matt Mackall # Date 2010-07-25 22:18:35 # Node ID a2f11188e2d2a05ad4057f3f3139e4119c7e1e3c # Parent dad1857613922727a7a97be9f001e3722ed34318 convert: handle closed branch heads in hg-hg conversion (issue2185) diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py --- a/hgext/convert/filemap.py +++ b/hgext/convert/filemap.py @@ -298,7 +298,9 @@ class filemap_source(converter_source): 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 --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -175,7 +175,8 @@ class mercurial_sink(converter_sink): 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 diff --git a/tests/test-convert-hg-source b/tests/test-convert-hg-source --- a/tests/test-convert-hg-source +++ b/tests/test-convert-hg-source @@ -32,6 +32,10 @@ hg ci -m 'merge remote copy' -d '4 0' chmod +x baz hg ci -m 'mark baz executable' -d '5 0' +hg branch foo +hg ci -m 'branch foo' -d '6 0' +hg ci --close-branch -m 'close' -d '7 0' + cd .. hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' cd new diff --git a/tests/test-convert-hg-source.out b/tests/test-convert-hg-source.out --- a/tests/test-convert-hg-source.out +++ b/tests/test-convert-hg-source.out @@ -7,16 +7,19 @@ merging foo and baz to baz 1 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) created new head +marked working directory as branch foo initializing destination new repository scanning source... sorting... converting... -5 add foo bar -4 change foo -3 make bar and baz copies of foo -2 merge local copy -1 merge remote copy -0 mark baz executable +7 add foo bar +6 change foo +5 make bar and baz copies of foo +4 merge local copy +3 merge remote copy +2 mark baz executable +1 branch foo +0 close comparing with ../orig searching for changes no changes found