pull: put discovery step in its own function
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 01 Apr 2014 17:35:25 -0700
changeset 20900 cb37fb91bc5a
parent 20899 d62319f91cb7
child 20901 a26dfa7f534c
pull: put discovery step in its own function The discovery is a full step that will grow to contain more than changesets. We set it in its own function like all other steps.
mercurial/exchange.py
--- a/mercurial/exchange.py	Tue Apr 01 17:28:21 2014 -0700
+++ b/mercurial/exchange.py	Tue Apr 01 17:35:25 2014 -0700
@@ -450,11 +450,7 @@
 
     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)
@@ -465,6 +461,17 @@
 
     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