Patchwork D2997: infinitepush: use bundleoperation.source instead of hacking on tr

login
register
mail settings
Submitter phabricator
Date March 31, 2018, 10:24 a.m.
Message ID <differential-rev-PHID-DREV-hv4kiayxeqctil42cukk-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30062/
State Superseded
Headers show

Comments

phabricator - March 31, 2018, 10:24 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previous patches added a soutce attribute to bundle2.bundleoperation class which
  stores the command which leads to current bundleoperation. Let's use that to
  decide whether a processing a `hg unbundle` or not instead of hacking on
  transaction.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/infinitepush/__init__.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: 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
@@ -927,10 +927,8 @@ 
 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 op.source == 'unbundle':
+        return orig(repo, op, unbundler)
 
     # this server routes each push to bundle store
     if repo.ui.configbool('infinitepush', 'pushtobundlestore'):