Browse Source

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>
maint
Felipe Contreras 12 years ago committed by Junio C Hamano
parent
commit
846cc77676
  1. 9
      contrib/remote-helpers/git-remote-hg

9
contrib/remote-helpers/git-remote-hg

@ -22,6 +22,7 @@ import shutil
import subprocess import subprocess
import urllib import urllib
import atexit import atexit
import urlparse


# #
# If you want to switch to hg-git compatibility mode: # If you want to switch to hg-git compatibility mode:
@ -793,11 +794,11 @@ def do_export(parser):
print print


def fix_path(alias, repo, orig_url): def fix_path(alias, repo, orig_url):
repo_url = util.url(repo.url()) url = urlparse.urlparse(orig_url, 'file')
url = util.url(orig_url) if url.scheme != 'file' or os.path.isabs(url.path):
if str(url) == str(repo_url):
return 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) subprocess.call(cmd)


def main(args): def main(args):

Loading…
Cancel
Save