Git development
 help / color / mirror / Atom feed
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 4/9] remote-bzr: add support to push URLs
Date: Fri, 26 Apr 2013 16:12:34 -0500	[thread overview]
Message-ID: <1367010759-17928-5-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1367010759-17928-1-git-send-email-felipe.contreras@gmail.com>

Just like in remote-hg.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-bzr | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index 7b6584e..f1d6d5e 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
+import atexit, shutil, hashlib
 
 NAME_RE = re.compile('^([^<>]+)')
 AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
@@ -719,11 +719,11 @@ def main(args):
     global blob_marks
     global parsed_refs
     global files_cache
+    global is_tmp
 
     alias = args[1]
     url = args[2]
 
-    prefix = 'refs/bzr/%s' % alias
     tags = {}
     filenodes = {}
     blob_marks = {}
@@ -731,6 +731,13 @@ def main(args):
     files_cache = {}
     marks = None
 
+    if alias[5:] == url:
+        is_tmp = True
+        alias = hashlib.sha1(alias).hexdigest()
+    else:
+        is_tmp = False
+
+    prefix = 'refs/bzr/%s' % alias
     gitdir = os.environ['GIT_DIR']
     dirname = os.path.join(gitdir, 'bzr', alias)
 
@@ -759,7 +766,10 @@ def main(args):
 def bye():
     if not marks:
         return
-    marks.store()
+    if not is_tmp:
+        marks.store()
+    else:
+        shutil.rmtree(dirname)
 
 atexit.register(bye)
 sys.exit(main(sys.argv))
-- 
1.8.2.1.1031.g2ee5873

  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 ` Felipe Contreras [this message]
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 ` [PATCH v3 6/9] remote-bzr: store converted URL Felipe Contreras
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-5-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