changeset 8165:78658990c725

convert/bzr: make it work with filemaps (issue1631) The bzr converter maintains a child -> parents mapping and drop entries whenever a child is read. It does not work with filemaps, getchangedfiles() may be called more than once when filtered files belong to merge revisions. getchanges() still works that way but it is not clear whether a similar issue can arise when interacting with merges.
author Patrick Mezard <pmezard@gmail.com>
date Sun, 26 Apr 2009 11:35:53 +0200
parents adce97d28389
children 56719b1aa6f4 c8c231da59c3
files hgext/convert/bzr.py tests/test-convert-bzr tests/test-convert-bzr.out
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/bzr.py	Fri Apr 24 10:34:11 2009 +0200
+++ b/hgext/convert/bzr.py	Sun Apr 26 11:35:53 2009 +0200
@@ -123,9 +123,8 @@
     def getchangedfiles(self, rev, i):
         self._modecache = {}
         curtree = self.sourcerepo.revision_tree(rev)
-        parentids = self._parentids.pop(rev)
         if i is not None:
-            parentid = parentids[i]
+            parentid = self._parentids[rev][i]
         else:
             # no parent id, get the empty revision
             parentid = revision.NULL_REVISION
--- a/tests/test-convert-bzr	Fri Apr 24 10:34:11 2009 +0200
+++ b/tests/test-convert-bzr	Sun Apr 26 11:35:53 2009 +0200
@@ -27,6 +27,12 @@
 echo "% test --rev option"
 hg convert -r 1 source source-1-hg
 glog -R source-1-hg
+echo "% test with filemap"
+cat > filemap <<EOF
+exclude a
+EOF
+hg convert --filemap filemap source source-filemap-hg
+hg -R source-filemap-hg manifest -r tip
 cd ..
 
 echo % merge
--- a/tests/test-convert-bzr.out	Fri Apr 24 10:34:11 2009 +0200
+++ b/tests/test-convert-bzr.out	Sun Apr 26 11:35:53 2009 +0200
@@ -25,6 +25,16 @@
 0 Initial add: a, c, e
 o  0 "Initial add: a, c, e" files: a c e
 
+% test with filemap
+initializing destination source-filemap-hg repository
+scanning source...
+sorting...
+converting...
+1 Initial add: a, c, e
+0 rename a into b, create a, rename c into d
+b
+d
+f
 % merge
 initializing destination source-hg repository
 scanning source...