[PATCH 07 of 11 (19 more to go)] push: explicitly feed pushop to localphasemove

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Mon Feb 10 18:01:35 CST 2014

# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1391141361 28800
#      Thu Jan 30 20:09:21 2014 -0800
# Node ID c4a1b8a92543a517520857c14568db1c7f4f077d
# Parent  41b273449477a7d28aeeb5b2479fd3eeb64e8cda
push: explicitly feed pushop to localphasemove

Now that pushop is holding all the push related data, we do not really need a
closure anymore. So we start feeding the object to `localphasemove` and will
make it a normal function in the next commit.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -64,11 +64,11 @@ def push(repo, remote, force=False, revs
     # servers, http servers).
     if not pushop.remote.canpush():
         raise util.Abort(_("destination does not support push"))
     unfi = pushop.repo.unfiltered()
-    def localphasemove(nodes, phase=phases.public):
+    def localphasemove(pushop, nodes, phase=phases.public):
         """move <nodes> to <phase> in the local source repo"""
         if pushop.locallocked:
             phases.advanceboundary(pushop.repo, phase, nodes)
             # repo is not locked, do not change any phases!
@@ -220,23 +220,23 @@ def push(repo, remote, force=False, revs
                 # We may be in issue 3871 case!
                 # We drop the possible phase synchronisation done by
                 # courtesy to publish changesets possibly locally draft
                 # on the remote.
                 remotephases = {'publishing': 'True'}
-            if not remotephases: # old server or public only repo
-                localphasemove(cheads)
+            if not remotephases: # old server or public only rer
+                localphasemove(pushop, cheads)
                 # don't push any phase data as there is nothing to push
                 ana = phases.analyzeremotephases(pushop.repo, cheads,
                 pheads, droots = ana
                 ### Apply remote phase on local
                 if remotephases.get('publishing', False):
-                    localphasemove(cheads)
+                    localphasemove(pushop, cheads)
                 else: # publish = False
-                    localphasemove(pheads)
-                    localphasemove(cheads, phases.draft)
+                    localphasemove(pushop, pheads)
+                    localphasemove(pushop, cheads, phases.draft)
                 ### Apply local phase on remote
                 # Get the list of all revs draft on remote by public here.
                 # XXX Beware that revset break if droots is not strictly
                 # XXX root we may want to ensure it is but it is costly

More information about the Mercurial-devel mailing list