Skip to content

Commit

Permalink
remote-bzr: store converted URL
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed Apr 26, 2013
1 parent 6134caf commit d82c912
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion contrib/remote-helpers/git-remote-bzr
Original file line number Diff line number Diff line change
Expand Up @@ -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('^([^<>]+?)? ?<([^<>]*)>$')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit d82c912

Please sign in to comment.