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>
This commit is contained in:
Felipe Contreras 2013-04-26 16:12:34 -05:00 committed by Junio C Hamano
parent d6bb9136c9
commit aa93845661

View File

@ -32,7 +32,7 @@ import os
import json import json
import re import re
import StringIO import StringIO
import atexit import atexit, shutil, hashlib
NAME_RE = re.compile('^([^<>]+)') NAME_RE = re.compile('^([^<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$') AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
@ -719,11 +719,11 @@ def main(args):
global blob_marks global blob_marks
global parsed_refs global parsed_refs
global files_cache global files_cache
global is_tmp
alias = args[1] alias = args[1]
url = args[2] url = args[2]
prefix = 'refs/bzr/%s' % alias
tags = {} tags = {}
filenodes = {} filenodes = {}
blob_marks = {} blob_marks = {}
@ -731,6 +731,13 @@ def main(args):
files_cache = {} files_cache = {}
marks = None 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'] gitdir = os.environ['GIT_DIR']
dirname = os.path.join(gitdir, 'bzr', alias) dirname = os.path.join(gitdir, 'bzr', alias)
@ -759,7 +766,10 @@ def main(args):
def bye(): def bye():
if not marks: if not marks:
return return
if not is_tmp:
marks.store() marks.store()
else:
shutil.rmtree(dirname)
atexit.register(bye) atexit.register(bye)
sys.exit(main(sys.argv)) sys.exit(main(sys.argv))