remote-bzr: update old organization
authorFelipe Contreras <felipe.contreras@gmail.com>
Tue, 14 May 2013 04:20:27 +0000 (23:20 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 May 2013 22:51:00 +0000 (15:51 -0700)
If a clone exists with the old organization (v1.8.2) it will prevent
the new shared bzr repository organization from working, so let's
remove this repository, which is not used any more.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/remote-helpers/git-remote-bzr
index 3e452af1dc1e3a2c6f67d10c1cea403709564671..b295dd489531f23bbaae5c07eeed6e94c2a9aa4c 100755 (executable)
@@ -830,6 +830,13 @@ def get_repo(url, alias):
         clone_path = os.path.join(dirname, 'clone')
         if not os.path.exists(clone_path):
             os.mkdir(clone_path)
+        else:
+            # check and remove old organization
+            try:
+                bdir = bzrlib.bzrdir.BzrDir.open(clone_path)
+                bdir.destroy_repository()
+            except bzrlib.errors.NotBranchError:
+                pass
 
     try:
         repo = origin.open_repository()