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

login
register
mail settings
Submitter Pierre-Yves David
Date April 2, 2014, 8:21 p.m.
Message ID <80c088fd9e10acf3e8ff.1396470106@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4204/
State Accepted
Commit cb37fb91bc5a3d88df4d74789802abd3d94d83c3
Headers show

Comments

Pierre-Yves David - April 2, 2014, 8:21 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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