Patchwork D2957: infinitepush: don't wrap bundle2.processparts while calling `hg unbundle`

login
register
mail settings
Submitter phabricator
Date March 27, 2018, 12:38 p.m.
Message ID <differential-rev-PHID-DREV-fp74tprdcdooy3jghhah-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29906/
State Superseded
Headers show

Comments

phabricator - March 27, 2018, 12:38 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds dirty logic to check whether we are processing `hg unbundle`
  instead of an `hg incoming` to prevent the wrapping of bundle2.processparts
  function.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2957

AFFECTED FILES
  hgext/infinitepush/__init__.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - March 30, 2018, 5:59 p.m.
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.


  Can the `op` argument be used instead?
  
  Also, given the hackiness of this, I'd feel much better if there were test coverage for `hg unbundle` continuing to work with this extension enabled.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2957

To: pulkit, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
phabricator - March 30, 2018, 6:05 p.m.
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  The next patch adds test coverage. So I think this is fine. A follow-up to make this less hacky (if possible) would be appreciated, but isn't required.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2957

To: pulkit, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py
--- a/hgext/infinitepush/__init__.py
+++ b/hgext/infinitepush/__init__.py
@@ -871,6 +871,13 @@ 
     return logger
 
 def processparts(orig, repo, op, unbundler):
+
+    # make sure we don't wrap processparts in case of `hg unbundle`
+    tr = repo.currenttransaction()
+    if tr:
+        if tr.names[0].startswith('unbundle'):
+            return orig(repo, op, unbundler)
+
     if unbundler.params.get('infinitepush') != 'True':
         return orig(repo, op, unbundler)