aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/remote-helpers
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-04-22 16:55:11 -0500
committerJunio C Hamano <gitster@pobox.com>2013-04-22 15:25:53 -0700
commit846cc77676df59d3f7962de95851ff498e273432 (patch)
tree991848c0e8e049410fafb301a671d260672e5c27 /contrib/remote-helpers
parente5ea5e7547fbb042b6d2ed04b73ff92d7543f672 (diff)
downloadgit-846cc77676df59d3f7962de95851ff498e273432.tar.gz
remote-hg: use python urlparse
It's simpler, and we don't need to depend on certain Mercurial versions. Also, now we don't update the URL if 'file://' is not present. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/remote-helpers')
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index dcf6c989a7..b6589a3df8 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -22,6 +22,7 @@ import shutil
import subprocess
import urllib
import atexit
+import urlparse
#
# If you want to switch to hg-git compatibility mode:
@@ -793,11 +794,11 @@ def do_export(parser):
print
def fix_path(alias, repo, orig_url):
- repo_url = util.url(repo.url())
- url = util.url(orig_url)
- if str(url) == str(repo_url):
+ url = urlparse.urlparse(orig_url, 'file')
+ if url.scheme != 'file' or os.path.isabs(url.path):
return
- cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % repo_url]
+ abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
+ cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % abs_url]
subprocess.call(cmd)
def main(args):