Mercurial > hg
changeset 10911:4327409c1303
merge
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Wed, 14 Apr 2010 19:43:40 +0200 |
parents | a6c4dd5175b5 (current diff) 78db9b7d9f65 (diff) |
children | 3d7c20986027 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 29 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Apr 14 11:27:15 2010 +0200 +++ b/mercurial/localrepo.py Wed Apr 14 19:43:40 2010 +0200 @@ -1516,13 +1516,8 @@ remote_heads = remote.heads() inc = self.findincoming(remote, common, remote_heads, force=force) - cl = self.changelog update, updated_heads = self.findoutgoing(remote, common, remote_heads) - msng_cl, bases, heads = cl.nodesbetween(update, revs) - - outgoingnodeset = set(msng_cl) - # compute set of nodes which, if they were a head before, no longer are - nolongeraheadnodeset = set(p for n in msng_cl for p in cl.parents(n)) + msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) def checkbranch(lheads, rheads, branchname=None): ''' @@ -1532,10 +1527,33 @@ lheads: local branch heads rheads: remote branch heads ''' - newlheads = [n for n in lheads if n in outgoingnodeset] - formerrheads = [n for n in rheads if n in nolongeraheadnodeset] - if len(newlheads) > len(formerrheads): - # we add more new heads than we demote former heads to non-head + + warn = 0 + + if len(lheads) > len(rheads): + warn = 1 + else: + # add local heads involved in the push + updatelheads = [self.changelog.heads(x, lheads) + for x in update] + newheads = set(sum(updatelheads, [])) & set(lheads) + + if not newheads: + return True + + # add heads we don't have or that are not involved in the push + for r in rheads: + if r in self.changelog.nodemap: + desc = self.changelog.heads(r, heads) + l = [h for h in heads if h in desc] + if not l: + newheads.add(r) + else: + newheads.add(r) + if len(newheads) > len(rheads): + warn = 1 + + if warn: if branchname is not None: msg = _("abort: push creates new remote heads" " on branch '%s'!\n") % branchname @@ -1599,7 +1617,7 @@ if revs is None: # use the fast path, no race possible on push - nodes = cl.findmissing(common.keys()) + nodes = self.changelog.findmissing(common.keys()) cg = self._changegroup(nodes, 'push') else: cg = self.changegroupsubset(update, revs, 'push')