# HG changeset patch # User Matt Mackall # Date 1280096315 18000 # Node ID a2f11188e2d2a05ad4057f3f3139e4119c7e1e3c # Parent dad1857613922727a7a97be9f001e3722ed34318 convert: handle closed branch heads in hg-hg conversion (issue2185) diff -r dad185761392 -r a2f11188e2d2 hgext/convert/filemap.py --- a/hgext/convert/filemap.py Sun Jul 25 17:10:32 2010 -0500 +++ b/hgext/convert/filemap.py Sun Jul 25 17:18:35 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 dad185761392 -r a2f11188e2d2 hgext/convert/hg.py --- a/hgext/convert/hg.py Sun Jul 25 17:10:32 2010 -0500 +++ b/hgext/convert/hg.py Sun Jul 25 17:18:35 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 diff -r dad185761392 -r a2f11188e2d2 tests/test-convert-hg-source --- a/tests/test-convert-hg-source Sun Jul 25 17:10:32 2010 -0500 +++ b/tests/test-convert-hg-source Sun Jul 25 17:18:35 2010 -0500 @@ -32,6 +32,10 @@ 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 -r dad185761392 -r a2f11188e2d2 tests/test-convert-hg-source.out --- a/tests/test-convert-hg-source.out Sun Jul 25 17:10:32 2010 -0500 +++ b/tests/test-convert-hg-source.out Sun Jul 25 17:18:35 2010 -0500 @@ -7,16 +7,19 @@ 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