Skip to content

Commit

Permalink
remote-bzr: add support to push URLs
Browse files Browse the repository at this point in the history
Just like in remote-hg.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed Apr 26, 2013
1 parent d6bb913 commit aa93845
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions contrib/remote-helpers/git-remote-bzr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import os
import json
import re
import StringIO
import atexit
import atexit, shutil, hashlib

NAME_RE = re.compile('^([^<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
Expand Down Expand Up @@ -719,18 +719,25 @@ def main(args):
global blob_marks
global parsed_refs
global files_cache
global is_tmp

alias = args[1]
url = args[2]

prefix = 'refs/bzr/%s' % alias
tags = {}
filenodes = {}
blob_marks = {}
parsed_refs = {}
files_cache = {}
marks = None

if alias[5:] == url:
is_tmp = True
alias = hashlib.sha1(alias).hexdigest()
else:
is_tmp = False

prefix = 'refs/bzr/%s' % alias
gitdir = os.environ['GIT_DIR']
dirname = os.path.join(gitdir, 'bzr', alias)

Expand Down Expand Up @@ -759,7 +766,10 @@ def main(args):
def bye():
if not marks:
return
marks.store()
if not is_tmp:
marks.store()
else:
shutil.rmtree(dirname)

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

0 comments on commit aa93845

Please sign in to comment.