From ffaf84c6631e1ee381ca0d04b363ee5c82fe20ac Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 4 Nov 2012 03:13:26 +0100 Subject: [PATCH] remote-hg: add support to push URLs Signed-off-by: Felipe Contreras Signed-off-by: Jeff King --- contrib/remote-helpers/git-remote-hg | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg index 45629e022..a5023c92f 100755 --- a/contrib/remote-helpers/git-remote-hg +++ b/contrib/remote-helpers/git-remote-hg @@ -9,12 +9,13 @@ # Then you can clone with: # git clone hg::/path/to/mercurial/repo/ -from mercurial import hg, ui, bookmarks, context +from mercurial import hg, ui, bookmarks, context, util import re import sys import os import json +import shutil NAME_RE = re.compile('^([^<>]+)') AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]+)>$') @@ -574,6 +575,12 @@ def main(args): url = args[2] peer = None + if alias[4:] == url: + is_tmp = True + alias = util.sha1(alias).hexdigest() + else: + is_tmp = False + gitdir = os.environ['GIT_DIR'] dirname = os.path.join(gitdir, 'hg', alias) branches = {} @@ -604,6 +611,9 @@ def main(args): die('unhandled command: %s' % line) sys.stdout.flush() - marks.store() + if not is_tmp: + marks.store() + else: + shutil.rmtree(dirname) sys.exit(main(sys.argv)) -- 2.26.2