From: William Giokas <1007380@gmail.com>
To: git@vger.kernel.org
Cc: William Giokas <1007380@gmail.com>
Subject: [PATCH v2] remote-hg: getbundle changed in mercurial 3.0
Date: Tue, 13 May 2014 15:21:46 -0500 [thread overview]
Message-ID: <1400012506-20705-1-git-send-email-1007380@gmail.com> (raw)
In-Reply-To: <1400008359-18267-1-git-send-email-1007380@gmail.com>
In mercurial 3.0, getbundle was moved to the changegroup module, and
gained a new argument. Due to this we cannot simply start using
getbundle(...) imported from either one unconditionally, as that would
cause errors in mercurial 3.0 without changing the syntax, and errors in
mercurial <3.0 if we do change it.
The try:except block at the beginning of git-remote-hg.py tries first to
import mercurial.changegroup.getbundle, and if that fails we set the
function 'getbundle' to work correctly with mercurial.repo.getbundle by
removing the first argument.
Signed-off-by: William Giokas <1007380@gmail.com>
---
So, what I had in there before would not work at all on repo.getbundle
because **kwargs only unpacks keyword args, not normal args. Sometimes my
brain works.
git-remote-hg.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/git-remote-hg.py b/git-remote-hg.py
index 34cda02..32eeffb 100755
--- a/git-remote-hg.py
+++ b/git-remote-hg.py
@@ -14,6 +14,13 @@
from mercurial import hg, ui, bookmarks, context, encoding, node, error, extensions, discovery, util
+try:
+ from mercurial.changegroup import getbundle
+
+except ImportError:
+ def getbundle(repo, **kwargs):
+ return repo.getbundle(**kwargs)
+
import re
import sys
import os
@@ -985,7 +992,8 @@ def push_unsafe(repo, remote, parsed_refs, p_revs):
if not checkheads(repo, remote, p_revs):
return None
- cg = repo.getbundle('push', heads=list(p_revs), common=common)
+ cg = getbundle(repo=repo, source='push', heads=list(p_revs),
+ common=common)
unbundle = remote.capable('unbundle')
if unbundle:
--
2.0.0.rc3
next prev parent reply other threads:[~2014-05-13 20:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 19:12 [PATCH] remote-hg: getbundle changed in mercurial 3.0 William Giokas
2014-05-13 20:21 ` William Giokas [this message]
2014-05-13 21:00 ` [PATCH v2] " Junio C Hamano
2014-05-13 20:33 ` [PATCH] " Junio C Hamano
2014-05-13 20:59 ` 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=1400012506-20705-1-git-send-email-1007380@gmail.com \
--to=1007380@gmail.com \
--cc=git@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).