Move the empty changeset detection out of findincoming to pull
This lets us reuse findincoming for findoutgoing
--- 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