# HG changeset patch # User Matt Mackall # Date 1120717256 28800 # Node ID ac0ec421e3a59d7b9457744ff3dbc1bc1910ece9 # Parent 85e2209d401cd10a5f7772ac6c5bc00f96aad74c Move the empty changeset detection out of findincoming to pull This lets us reuse findincoming for findoutgoing diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -870,12 +870,7 @@ class localrepository: 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 @@ class localrepository: 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