Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 2108:30c7564f6dfc
Move empty local repo logic for pull into findincoming
This fixes a silly attempt to pull a changegroup from an empty repo.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 21 Apr 2006 15:33:51 -0500 |
parents | 7ff92c04f8e5 |
children | 1b183976e007 |
comparison
equal
deleted
inserted
replaced
2107:7ff92c04f8e5 | 2108:30c7564f6dfc |
---|---|
829 seen = {} | 829 seen = {} |
830 seenbranch = {} | 830 seenbranch = {} |
831 if base == None: | 831 if base == None: |
832 base = {} | 832 base = {} |
833 | 833 |
834 if not heads: | |
835 heads = remote.heads() | |
836 | |
837 if self.changelog.tip() == nullid: | |
838 if heads != [nullid]: | |
839 return [nullid] | |
840 return [] | |
841 | |
834 # assume we're closer to the tip than the root | 842 # assume we're closer to the tip than the root |
835 # and start by examining the heads | 843 # and start by examining the heads |
836 self.ui.status(_("searching for changes\n")) | 844 self.ui.status(_("searching for changes\n")) |
837 | |
838 if not heads: | |
839 heads = remote.heads() | |
840 | 845 |
841 unknown = [] | 846 unknown = [] |
842 for h in heads: | 847 for h in heads: |
843 if h not in m: | 848 if h not in m: |
844 unknown.append(h) | 849 unknown.append(h) |
996 return subset | 1001 return subset |
997 | 1002 |
998 def pull(self, remote, heads=None, force=False): | 1003 def pull(self, remote, heads=None, force=False): |
999 l = self.lock() | 1004 l = self.lock() |
1000 | 1005 |
1001 # if we have an empty repo, fetch everything | 1006 fetch = self.findincoming(remote, force=force) |
1002 if self.changelog.tip() == nullid: | 1007 if fetch == [nullid]: |
1003 self.ui.status(_("requesting all changes\n")) | 1008 self.ui.status(_("requesting all changes\n")) |
1004 fetch = [nullid] | |
1005 else: | |
1006 fetch = self.findincoming(remote, force=force) | |
1007 | 1009 |
1008 if not fetch: | 1010 if not fetch: |
1009 self.ui.status(_("no changes found\n")) | 1011 self.ui.status(_("no changes found\n")) |
1010 return 0 | 1012 return 0 |
1011 | 1013 |