Move the empty changeset detection out of findincoming to pull
authorMatt Mackall <mpm@selenic.com>
Wed, 06 Jul 2005 22:20:56 -0800
changeset 636 ac0ec421e3a5
parent 635 85e2209d401c
child 637 31e090c34d3b
Move the empty changeset detection out of findincoming to pull This lets us reuse findincoming for findoutgoing
mercurial/hg.py
--- a/mercurial/hg.py	Wed Jul 06 22:20:12 2005 -0800
+++ b/mercurial/hg.py	Wed Jul 06 22:20:56 2005 -0800
@@ -870,12 +870,7 @@
         seen = {}
         seenbranch = {}
 
-        # if we have an empty repo, fetch everything
-        if self.changelog.tip() == nullid:
-            self.ui.status("requesting all changes\n")
-            return [nullid]
-
-        # otherwise, assume we're closer to the tip than the root
+        # assume we're closer to the tip than the root
         # and start by examining the heads
         self.ui.status("searching for changes\n")
         heads = remote.heads()
@@ -1006,7 +1001,14 @@
 
     def pull(self, remote):
         lock = self.lock()
-        fetch = self.findincoming(remote)
+
+        # if we have an empty repo, fetch everything
+        if self.changelog.tip() == nullid:
+            self.ui.status("requesting all changes\n")
+            fetch = [nullid]
+        else:
+            fetch = self.findincoming(remote)
+
         if not fetch:
             self.ui.status("no changes found\n")
             return 1