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>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
	Daniel Barkalow <barkalow@iabervon.org>,
	Jeff King <peff@peff.net>,
	Michael J Gruber <git@drmicha.warpmail.net>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v3 3/6] remote-hg: add support for remote pushing
Date: Sun, 21 Oct 2012 19:49:01 +0200	[thread overview]
Message-ID: <1350841744-21564-4-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1350841744-21564-1-git-send-email-felipe.contreras@gmail.com>

I'm not happy with this, but works.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-hg/git-remote-hg | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-hg/git-remote-hg b/contrib/remote-hg/git-remote-hg
index fc4510c..34a00cd 100755
--- a/contrib/remote-hg/git-remote-hg
+++ b/contrib/remote-hg/git-remote-hg
@@ -167,6 +167,7 @@ def fixup_user(user):
 
 def get_repo(url, alias):
     global dirname
+    global peer
 
     myui = ui.ui()
     myui.setconfig('ui', 'interactive', 'off')
@@ -176,7 +177,7 @@ def get_repo(url, alias):
     else:
         local_path = os.path.join(dirname, 'clone')
         if not os.path.exists(local_path):
-            srcpeer, dstpeer = hg.clone(myui, {}, url, local_path, update=False, pull=True)
+            peer, dstpeer = hg.clone(myui, {}, url, local_path, update=False, pull=True)
             repo = dstpeer.local()
         else:
             repo = hg.repository(myui, local_path)
@@ -420,6 +421,8 @@ def parse_commit(parser):
     print "ok %s" % ref
 
 def do_export(parser):
+    global peer
+
     for line in parser.each_block('done'):
         if parser.check('blob'):
             parse_blob(parser)
@@ -427,12 +430,17 @@ def do_export(parser):
             parse_commit(parser)
     print
 
+    if peer:
+        parser.repo.push(peer, force=False)
+
 def main(args):
     global prefix, dirname, branches
     global marks, blob_marks
+    global peer
 
     alias = args[1]
     url = args[2]
+    peer = None
 
     gitdir = os.environ['GIT_DIR']
     dirname = os.path.join(gitdir, 'hg', alias)
-- 
1.8.0.rc2.7.g0961fdf.dirty

  parent reply	other threads:[~2012-10-21 17:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-21 17:48 [PATCH v3 0/6] New remote-hg helper Felipe Contreras
2012-10-21 17:48 ` [PATCH v3 1/6] Add new remote-hg transport helper Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 2/6] remote-hg: add support for pushing Felipe Contreras
2012-10-21 17:49 ` Felipe Contreras [this message]
2012-10-21 17:49 ` [PATCH v3 4/6] remote-hg: add support for trivial features Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 5/6] tests: add remote-hg tests Felipe Contreras
2012-10-21 21:02   ` Sverre Rabbelier
2012-10-24 15:47     ` Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 6/6] tests: fix remote-hg warnings for modern git Felipe Contreras

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=1350841744-21564-4-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=barkalow@iabervon.org \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ilari.liusvaara@elisanet.fi \
    --cc=peff@peff.net \
    --cc=srabbelier@gmail.com \
    /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