changeset 16061:915e06faa8f3

convert/bzr: handle empty bzr repositories (issue3233)
author Patrick Mezard <pmezard@gmail.com>
date Thu, 02 Feb 2012 10:15:13 +0100
parents f84dda152a55
children 718b81e8b876
files hgext/convert/bzr.py tests/test-convert-bzr.t
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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...