summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-04-26 21:12:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-26 22:20:27 (GMT)
commitd82c912c430d63456350ae39ea6d1fa7ba88006d (patch)
tree74d94a25b64f07538671c9a9ff824df513c12c2b
parent6134caf2c10b9cd0df431fdefcf145984aeb80e3 (diff)
downloadgit-d82c912c430d63456350ae39ea6d1fa7ba88006d.zip
git-d82c912c430d63456350ae39ea6d1fa7ba88006d.tar.gz
git-d82c912c430d63456350ae39ea6d1fa7ba88006d.tar.bz2
remote-bzr: store converted URL
Bazaar might convert the URL to something more appropriate, like an absolute path. Lets store that instead of the original URL, which won't work from a different working directory if it's relative. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xcontrib/remote-helpers/git-remote-bzr13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index c92a992..34f6156 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -32,7 +32,7 @@ import os
import json
import re
import StringIO
-import atexit, shutil, hashlib
+import atexit, shutil, hashlib, urlparse, subprocess
NAME_RE = re.compile('^([^<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
@@ -713,6 +713,14 @@ def get_repo(url, alias):
return branch
+def fix_path(alias, orig_url):
+ url = urlparse.urlparse(orig_url, 'file')
+ if url.scheme != 'file' or os.path.isabs(url.path):
+ return
+ abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
+ cmd = ['git', 'config', 'remote.%s.url' % alias, "bzr::%s" % abs_url]
+ subprocess.call(cmd)
+
def main(args):
global marks, prefix, dirname
global tags, filenodes
@@ -741,6 +749,9 @@ def main(args):
gitdir = os.environ['GIT_DIR']
dirname = os.path.join(gitdir, 'bzr', alias)
+ if not is_tmp:
+ fix_path(alias, url)
+
if not os.path.exists(dirname):
os.makedirs(dirname)