summaryrefslogtreecommitdiff
path: root/contrib/remote-helpers/git-remote-hg
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/remote-helpers/git-remote-hg')
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg15
1 files changed, 13 insertions, 2 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 016cdad..328c2dc 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -31,7 +31,7 @@ import urllib
# hg:
# Emulate hg-git.
# Only hg bookmarks are exported as git branches.
-# Commits are modified to preserve hg information and allow biridectionality.
+# Commits are modified to preserve hg information and allow bidirectionality.
#
NAME_RE = re.compile('^([^<>]+)')
@@ -53,7 +53,7 @@ def gittz(tz):
return '%+03d%02d' % (-tz / 3600, -tz % 3600 / 60)
def hgmode(mode):
- m = { '0100755': 'x', '0120000': 'l' }
+ m = { '100755': 'x', '120000': 'l' }
return m.get(mode, '')
def get_config(config):
@@ -720,6 +720,14 @@ def do_export(parser):
if peer:
parser.repo.push(peer, force=False)
+def fix_path(alias, repo, orig_url):
+ repo_url = util.url(repo.url())
+ url = util.url(orig_url)
+ if str(url) == str(repo_url):
+ return
+ cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % repo_url]
+ subprocess.call(cmd)
+
def main(args):
global prefix, dirname, branches, bmarks
global marks, blob_marks, parsed_refs
@@ -766,6 +774,9 @@ def main(args):
repo = get_repo(url, alias)
prefix = 'refs/hg/%s' % alias
+ if not is_tmp:
+ fix_path(alias, peer or repo, url)
+
if not os.path.exists(dirname):
os.makedirs(dirname)