From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v3 6/9] remote-bzr: store converted URL
Date: Fri, 26 Apr 2013 16:12:36 -0500 [thread overview]
Message-ID: <1367010759-17928-7-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1367010759-17928-1-git-send-email-felipe.contreras@gmail.com>
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>
---
contrib/remote-helpers/git-remote-bzr | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index f1d6d5e..dda2932 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)
--
1.8.2.1.1031.g2ee5873
next prev parent reply other threads:[~2013-04-26 21:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 21:12 [PATCH v3 0/9] remote-helpers: fixes and cleanups Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 1/9] remote-helpers: trivial cleanups Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 2/9] remote-hg: remove extra check Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 3/9] remote-bzr: fix bad state issue Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 4/9] remote-bzr: add support to push URLs Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 5/9] remote-hg: use hashlib instead of hg sha1 util Felipe Contreras
2013-04-26 21:12 ` Felipe Contreras [this message]
2013-04-26 21:12 ` [PATCH v3 7/9] remote-bzr: tell bazaar to be quiet Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 8/9] remote-bzr: strip extra newline Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 9/9] remote-bzr: use proper push method Felipe Contreras
2013-04-26 22:16 ` [PATCH v3 0/9] remote-helpers: fixes and cleanups Junio C Hamano
2013-04-26 22:23 ` Junio C Hamano
2013-04-26 22:40 ` Felipe Contreras
2013-04-26 23:04 ` Junio C Hamano
2013-04-27 2:56 ` Ramkumar Ramachandra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1367010759-17928-7-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox