comparison mercurial/hg.py @ 636:ac0ec421e3a5

Move the empty changeset detection out of findincoming to pull This lets us reuse findincoming for findoutgoing
author Matt Mackall <mpm@selenic.com>
date Wed, 06 Jul 2005 22:20:56 -0800
parents 85e2209d401c
children 31e090c34d3b
comparison
equal deleted inserted replaced
635:85e2209d401c 636:ac0ec421e3a5
868 search = [] 868 search = []
869 fetch = [] 869 fetch = []
870 seen = {} 870 seen = {}
871 seenbranch = {} 871 seenbranch = {}
872 872
873 # if we have an empty repo, fetch everything 873 # assume we're closer to the tip than the root
874 if self.changelog.tip() == nullid:
875 self.ui.status("requesting all changes\n")
876 return [nullid]
877
878 # otherwise, assume we're closer to the tip than the root
879 # and start by examining the heads 874 # and start by examining the heads
880 self.ui.status("searching for changes\n") 875 self.ui.status("searching for changes\n")
881 heads = remote.heads() 876 heads = remote.heads()
882 unknown = [] 877 unknown = []
883 for h in heads: 878 for h in heads:
1004 # this is the set of all roots we have to push 999 # this is the set of all roots we have to push
1005 return subset 1000 return subset
1006 1001
1007 def pull(self, remote): 1002 def pull(self, remote):
1008 lock = self.lock() 1003 lock = self.lock()
1009 fetch = self.findincoming(remote) 1004
1005 # if we have an empty repo, fetch everything
1006 if self.changelog.tip() == nullid:
1007 self.ui.status("requesting all changes\n")
1008 fetch = [nullid]
1009 else:
1010 fetch = self.findincoming(remote)
1011
1010 if not fetch: 1012 if not fetch:
1011 self.ui.status("no changes found\n") 1013 self.ui.status("no changes found\n")
1012 return 1 1014 return 1
1013 1015
1014 cg = remote.changegroup(fetch) 1016 cg = remote.changegroup(fetch)