remote-bzr: add fallback check for a partial clone
authorFelipe Contreras <felipe.contreras@gmail.com>
Sat, 25 May 2013 02:24:26 +0000 (21:24 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 May 2013 14:43:25 +0000 (07:43 -0700)
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 3248586b13d8c1b43697cf85107a9f4708563a38..3cd65723c3ad04e0b339d17b36ece64d537f23f7 100755 (executable)
@@ -766,7 +766,10 @@ def do_list(parser):
     print
 
 def clone(path, remote_branch):
-    bdir = bzrlib.bzrdir.BzrDir.create(path)
+    try:
+        bdir = bzrlib.bzrdir.BzrDir.create(path)
+    except bzrlib.errors.AlreadyControlDirError:
+        bdir = bzrlib.bzrdir.BzrDir.open(path)
     repo = bdir.find_repository()
     repo.fetch(remote_branch.repository)
     return remote_branch.sprout(bdir, repository=repo)