summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2013-04-26 16:12:34 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-04-26 15:20:27 -0700
commitaa9384566161a242ad0ca2563e613736edf38fe9 (patch)
tree0bb83c46690d6b136b1e02c90b91eb7488b6a505 /contrib
parentremote-bzr: fix bad state issue (diff)
downloadtgif-aa9384566161a242ad0ca2563e613736edf38fe9.tar.xz
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>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/remote-helpers/git-remote-bzr16
1 files changed, 13 insertions, 3 deletions
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index bfc298b2e1..c92a9924ee 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -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('^([^<>]+?)? ?<([^<>]*)>$')
@@ -719,11 +719,11 @@ 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 = {}
@@ -731,6 +731,13 @@ def main(args):
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)
@@ -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))