convert: handle closed branch heads in hg-hg conversion (issue2185)

This commit is contained in:
Matt Mackall 2010-07-25 17:18:35 -05:00
parent 661034417e
commit 3c358f36d4
4 changed files with 18 additions and 8 deletions

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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