termie/git-bzr-ng

Does not work with older bzr repo formats (ie pack-0.92)

Opened this issue · 1 comments

I have been trying to use git-bzr-ng to work with a BZR repo that is stuck in the dark ages using format pack-0.92. Unfortunately, when using git bzr clone (or branch, etc) it defaults to using the local bzr default -- which on modern versions of bzr is format 2a.

This does on-the-fly conversion, and then when you try to push into the repo you get an error like this:
bzr: ERROR: KnitPackRepository(PATH_TO_BZR_REPO) is not compatible with CHKInventoryRepository(PATH_TO_GIT_BZR_REPO)

Being able to specify the bzr format to use for the local repo could solve this problem. Perhaps with syntax like 'git bzr clone --format=pack-0.92 ...' which passes the --format parameter on to bzr()

tmm1 commented

I was having similar problems and had to do the following:

diff --git a/git-bzr b/git-bzr
index 327d935..b1c66e4 100755
--- a/git-bzr
+++ b/git-bzr
@@ -315,6 +315,7 @@ def export_git(branch, cl=None, parent_branch=None):

   # NOTE(termie): this happens in reverse because we're piping
   bzr_proc = bzr(['fast-import'] + bzr_import_arg + [
+                  '--format=pack-0.92',
                   '--export-marks=%s' % bzr_marks,
                   '-',
                   cl.bzr_dir(branch)],
@@ -345,7 +346,7 @@ def init_repo(cl=None):
   if not os.path.exists(cl.bzr_dir()):
     os.makedirs(cl.bzr_dir())
     # Initialize a bzr repo
-    bzr(['init-repo', '--no-trees', cl.bzr_dir()])
+    bzr(['init-repo', '--pack-0.92', '--format=pack-0.92', '--no-trees', cl.bzr_dir()])

   if not os.path.exists(cl.map_dir()):
     os.makedirs(cl.map_dir())
@@ -367,7 +368,7 @@ def cmd_init(args):
   if branch_exists(bzr_ref):
     die('Branch already exists: %s', bzr_ref)

-  bzr(['init', cl.bzr_dir(branch)])
+  bzr(['init', '--format=pack-0.92', '--pack-0.92', cl.bzr_dir(branch)])

   export_git(branch, cl=cl)