[PATCH 3 of 4] convert/bzr: handle empty bzr repositories (issue3233)

Patrick Mezard pmezard at gmail.com
Thu Feb 2 03:17:15 CST 2012


# HG changeset patch
# User Patrick Mezard <pmezard at gmail.com>
# Date 1328174113 -3600
# Branch stable
# Node ID dc96c0da5966b033b519a6071c5fb67522582b76
# Parent  ea9bcf7b3020a01eb5d3f11aa5ad0ae07254896d
convert/bzr: handle empty bzr repositories (issue3233)

diff --git a/hgext/convert/bzr.py b/hgext/convert/bzr.py
--- a/hgext/convert/bzr.py
+++ b/hgext/convert/bzr.py
@@ -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):
diff --git a/tests/test-convert-bzr.t b/tests/test-convert-bzr.t
--- a/tests/test-convert-bzr.t
+++ b/tests/test-convert-bzr.t
@@ -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...


More information about the Mercurial-devel mailing list