Skip to content

Commit aa93845

Browse files
Felipe Contrerasgitster
authored andcommitted
remote-bzr: add support to push URLs
Just like in remote-hg. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d6bb913 commit aa93845

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

contrib/remote-helpers/git-remote-bzr

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import os
3232
import json
3333
import re
3434
import StringIO
35-
import atexit
35+
import atexit, shutil, hashlib
3636

3737
NAME_RE = re.compile('^([^<>]+)')
3838
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
@@ -719,18 +719,25 @@ def main(args):
719719
global blob_marks
720720
global parsed_refs
721721
global files_cache
722+
global is_tmp
722723

723724
alias = args[1]
724725
url = args[2]
725726

726-
prefix = 'refs/bzr/%s' % alias
727727
tags = {}
728728
filenodes = {}
729729
blob_marks = {}
730730
parsed_refs = {}
731731
files_cache = {}
732732
marks = None
733733

734+
if alias[5:] == url:
735+
is_tmp = True
736+
alias = hashlib.sha1(alias).hexdigest()
737+
else:
738+
is_tmp = False
739+
740+
prefix = 'refs/bzr/%s' % alias
734741
gitdir = os.environ['GIT_DIR']
735742
dirname = os.path.join(gitdir, 'bzr', alias)
736743

@@ -759,7 +766,10 @@ def main(args):
759766
def bye():
760767
if not marks:
761768
return
762-
marks.store()
769+
if not is_tmp:
770+
marks.store()
771+
else:
772+
shutil.rmtree(dirname)
763773

764774
atexit.register(bye)
765775
sys.exit(main(sys.argv))

0 commit comments

Comments
 (0)