git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 3/6] remote-hg: add support for remote pushing

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Oct 21, 2012, 17:49 UTC
Message-ID
<1350841744-21564-4-git-send-email-felipe.contreras@gmail.com>
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
Previous: Felipe ContrerasNext: Felipe Contreras
Message 4 of 9 in “New remote-hg helper”
  1. 0/6 New remote-hg helperFelipe Contreras, Oct 21, 2012
  2. 1/6 Add new remote-hg transport helperFelipe Contreras, Oct 21, 2012
  3. 2/6 remote-hg: add support for pushingFelipe Contreras, Oct 21, 2012
  4. 3/6 remote-hg: add support for remote pushingFelipe Contreras, Oct 21, 2012
  5. 4/6 remote-hg: add support for trivial featuresFelipe Contreras, Oct 21, 2012
  6. 5/6 tests: add remote-hg testsFelipe Contreras, Oct 21, 2012
  7. Sverre RabbelierOct 21, 2012
  8. Felipe ContrerasOct 24, 2012
  9. 6/6 tests: fix remote-hg warnings for modern gitFelipe Contreras, Oct 21, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.