[PATCH 3 of 4] pull: put discovery step in its own function

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Wed Apr 2 15:21:46 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1396398925 25200
#      Tue Apr 01 17:35:25 2014 -0700
# Node ID 80c088fd9e10acf3e8ffcd4e35ce964d528a84cd
# Parent  5666cf55a987cd4df9919ced3f48ed16e1381590
pull: put discovery step in its own function

The discovery is a full step that will grow to contains more than changeset. We
set it in its own function like all other step.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -443,25 +443,33 @@ def pull(repo, remote, heads=None, force
                     " %s") % (', '.join(sorted(missing)))
             raise util.Abort(msg)
 
     lock = pullop.repo.lock()
     try:
-        tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
-                                           pullop.remote,
-                                           heads=pullop.heads,
-                                           force=force)
-        pullop.common, pullop.fetch, pullop.rheads = tmp
+        _pulldiscovery(pullop)
         _pullchangeset(pullop)
         _pullphase(pullop)
         _pullobsolete(pullop)
         pullop.closetransaction()
     finally:
         pullop.releasetransaction()
         lock.release()
 
     return pullop.cgresult
 
+def _pulldiscovery(pullop):
+    """discovery phase for the pull
+
+    Current handle changeset discovery only, will change handle all discovery
+    at some point."""
+    tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
+                                       pullop.remote,
+                                       heads=pullop.heads,
+                                       force=pullop.force)
+    pullop.common, pullop.fetch, pullop.rheads = tmp
+
+
 def _pullchangeset(pullop):
     """pull changeset from unbundle into the local repo"""
     # We delay the open of the transaction as late as possible so we
     # don't open transaction for nothing or you break future useful
     # rollback call


More information about the Mercurial-devel mailing list