# HG changeset patch # User Matt Mackall # Date 1145651631 18000 # Node ID 30c7564f6dfc12ea2637a27e72743c22e0ab3126 # Parent 7ff92c04f8e5041ccd6d1072d49ab6748798bf4c Move empty local repo logic for pull into findincoming This fixes a silly attempt to pull a changegroup from an empty repo. diff -r 7ff92c04f8e5 -r 30c7564f6dfc mercurial/localrepo.py --- a/mercurial/localrepo.py Fri Apr 21 15:14:27 2006 -0500 +++ b/mercurial/localrepo.py Fri Apr 21 15:33:51 2006 -0500 @@ -831,13 +831,18 @@ if base == None: base = {} + if not heads: + heads = remote.heads() + + if self.changelog.tip() == nullid: + if heads != [nullid]: + return [nullid] + return [] + # assume we're closer to the tip than the root # and start by examining the heads self.ui.status(_("searching for changes\n")) - if not heads: - heads = remote.heads() - unknown = [] for h in heads: if h not in m: @@ -998,12 +1003,9 @@ def pull(self, remote, heads=None, force=False): l = self.lock() - # if we have an empty repo, fetch everything - if self.changelog.tip() == nullid: + fetch = self.findincoming(remote, force=force) + if fetch == [nullid]: self.ui.status(_("requesting all changes\n")) - fetch = [nullid] - else: - fetch = self.findincoming(remote, force=force) if not fetch: self.ui.status(_("no changes found\n")) diff -r 7ff92c04f8e5 -r 30c7564f6dfc tests/test-bad-pull.out --- a/tests/test-bad-pull.out Fri Apr 21 15:14:27 2006 -0500 +++ b/tests/test-bad-pull.out Fri Apr 21 15:33:51 2006 -0500 @@ -1,7 +1,5 @@ -requesting all changes abort: error: Connection refused 255 copy: No such file or directory -requesting all changes abort: HTTP Error 404: File not found 255 diff -r 7ff92c04f8e5 -r 30c7564f6dfc tests/test-clone-failure.out --- a/tests/test-clone-failure.out Fri Apr 21 15:14:27 2006 -0500 +++ b/tests/test-clone-failure.out Fri Apr 21 15:33:51 2006 -0500 @@ -1,6 +1,5 @@ abort: repository a not found! 255 -requesting all changes abort: error: Connection refused 255 abort: repository a not found!