From: Felipe Contreras Date: Sun, 28 Oct 2012 03:54:05 GMT Subject: [PATCH v4 05/13] remote-hg: add support to push URLs Message-ID: <1351396453-29042-6-git-send-email-felipe.contreras@gmail.com> In-Reply-To: <1351396453-29042-1-git-send-email-felipe.contreras@gmail.com> Signed-off-by: Felipe Contreras --- contrib/remote-hg/git-remote-hg | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/remote-hg/git-remote-hg b/contrib/remote-hg/git-remote-hg index b10e7d1..c96e1a8 100755 --- a/contrib/remote-hg/git-remote-hg +++ b/contrib/remote-hg/git-remote-hg @@ -6,12 +6,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('^([^<>]+?)? ?<([^<>]+)>$') @@ -551,6 +552,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 = {} @@ -581,6 +588,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)) -- 1.8.0