changeset 20486:0c469df6e914

pull: move phases synchronisation in its own function Now that every necessary information is held in the `pulloperation` object, we can finally extract the phase synchronisation phase to it's own function. This changeset is pure code movement only.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 31 Jan 2014 01:25:56 -0800
parents de2544933139
children f715cc0b5107
files mercurial/exchange.py
diffstat 1 files changed, 19 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Fri Jan 31 01:21:42 2014 -0800
+++ b/mercurial/exchange.py	Fri Jan 31 01:25:56 2014 -0800
@@ -473,23 +473,7 @@
             subset = pullop.heads
         pullop.pulledsubset = subset
 
-        # Get remote phases data from remote
-        remotephases = pullop.remote.listkeys('phases')
-        publishing = bool(remotephases.get('publishing', False))
-        if remotephases and not publishing:
-            # remote is new and unpublishing
-            pheads, _dr = phases.analyzeremotephases(pullop.repo,
-                                                     pullop.pulledsubset,
-                                                     remotephases)
-            phases.advanceboundary(pullop.repo, phases.public, pheads)
-            phases.advanceboundary(pullop.repo, phases.draft,
-                                   pullop.pulledsubset)
-        else:
-            # Remote is old or publishing all common changesets
-            # should be seen as public
-            phases.advanceboundary(pullop.repo, phases.public,
-                                   pullop.pulledsubset)
-
+        _pullphase(pullop)
         _pullobsolete(pullop)
         pullop.closetransaction()
     finally:
@@ -498,6 +482,24 @@
 
     return result
 
+def _pullphase(pullop):
+    # Get remote phases data from remote
+    remotephases = pullop.remote.listkeys('phases')
+    publishing = bool(remotephases.get('publishing', False))
+    if remotephases and not publishing:
+        # remote is new and unpublishing
+        pheads, _dr = phases.analyzeremotephases(pullop.repo,
+                                                 pullop.pulledsubset,
+                                                 remotephases)
+        phases.advanceboundary(pullop.repo, phases.public, pheads)
+        phases.advanceboundary(pullop.repo, phases.draft,
+                               pullop.pulledsubset)
+    else:
+        # Remote is old or publishing all common changesets
+        # should be seen as public
+        phases.advanceboundary(pullop.repo, phases.public,
+                               pullop.pulledsubset)
+
 def _pullobsolete(pullop):
     """utility function to pull obsolete markers from a remote