diff --git a/mercurial/hg.py b/mercurial/hg.py index 37625132fe375d694c60a497ac962d02ea87a9d9_bWVyY3VyaWFsL2hnLnB5..3dd5ce2fddb65c05da9c5eded60fe738dc186bc5_bWVyY3VyaWFsL2hnLnB5 100644 --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -525,7 +525,4 @@ return nl def getchangegroup(self, remote): - tip = remote.branches([])[0] - self.ui.debug("remote tip branch is %s:%s\n" % - (short(tip[0]), short(tip[1]))) m = self.changelog.nodemap @@ -531,6 +528,5 @@ m = self.changelog.nodemap - unknown = [tip] search = [] fetch = [] seen = {} seenbranch = {} @@ -533,7 +529,17 @@ search = [] fetch = [] seen = {} seenbranch = {} + tip = remote.branches([])[0] + self.ui.debug("remote tip branch is %s:%s\n" % + (short(tip[0]), short(tip[1]))) + + # if we have an empty repo, fetch everything + if self.changelog.tip() == nullid: + return remote.changegroup([nullid]) + + # otherwise, assume we're closer to the tip than the root + unknown = [tip] if tip[0] in m: self.ui.note("nothing to do!\n")