push: explicitly feed pushop to localphasemove
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 30 Jan 2014 20:09:21 -0800
changeset 20437 9e54faf37ff8
parent 20436 2f2e8d1c4856
child 20438 2b5ab0d11327
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.
mercurial/exchange.py
--- a/mercurial/exchange.py	Thu Jan 30 20:00:34 2014 -0800
+++ b/mercurial/exchange.py	Thu Jan 30 20:09:21 2014 -0800
@@ -66,7 +66,7 @@
     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)
@@ -222,8 +222,8 @@
                 # 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
             else:
                 ana = phases.analyzeremotephases(pushop.repo, cheads,
@@ -231,10 +231,10 @@
                 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.