convert/bzr: handle empty bzr repositories (issue3233)
authorPatrick Mezard <pmezard@gmail.com>
Thu, 02 Feb 2012 10:15:13 +0100
changeset 16061 915e06faa8f3
parent 16060 f84dda152a55
child 16062 718b81e8b876
convert/bzr: handle empty bzr repositories (issue3233)
hgext/convert/bzr.py
tests/test-convert-bzr.t
--- a/hgext/convert/bzr.py	Thu Feb 02 10:15:12 2012 +0100
+++ b/hgext/convert/bzr.py	Thu Feb 02 10:15:13 2012 +0100
@@ -107,6 +107,8 @@
             if revid is None:
                 raise util.Abort(_('%s is not a valid revision') % self.rev)
             heads = [revid]
+        # Empty repositories return 'null:', which cannot be retrieved
+        heads = [h for h in heads if h != 'null:']
         return heads
 
     def getfile(self, name, rev):
--- a/tests/test-convert-bzr.t	Thu Feb 02 10:15:12 2012 +0100
+++ b/tests/test-convert-bzr.t	Thu Feb 02 10:15:13 2012 +0100
@@ -7,6 +7,17 @@
   $ mkdir test-createandrename
   $ cd test-createandrename
   $ bzr init -q source
+
+test empty repo conversion (issue3233)
+
+  $ hg convert source source-hg
+  initializing destination source-hg repository
+  scanning source...
+  sorting...
+  converting...
+
+back to the rename stuff
+
   $ cd source
   $ echo a > a
   $ echo c > c
@@ -25,7 +36,6 @@
   $ bzr commit -q -m 'rename a into b, create a, rename c into d'
   $ cd ..
   $ hg convert source source-hg
-  initializing destination source-hg repository
   scanning source...
   sorting...
   converting...