Show More
@@ -1516,13 +1516,8 b' class localrepository(repo.repository):' | |||
|
1516 | 1516 | remote_heads = remote.heads() |
|
1517 | 1517 | inc = self.findincoming(remote, common, remote_heads, force=force) |
|
1518 | 1518 | |
|
1519 | cl = self.changelog | |
|
1520 | 1519 | update, updated_heads = self.findoutgoing(remote, common, remote_heads) |
|
1521 | msng_cl, bases, heads = cl.nodesbetween(update, revs) | |
|
1522 | ||
|
1523 | outgoingnodeset = set(msng_cl) | |
|
1524 | # compute set of nodes which, if they were a head before, no longer are | |
|
1525 | nolongeraheadnodeset = set(p for n in msng_cl for p in cl.parents(n)) | |
|
1520 | msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) | |
|
1526 | 1521 | |
|
1527 | 1522 | def checkbranch(lheads, rheads, branchname=None): |
|
1528 | 1523 | ''' |
@@ -1532,10 +1527,33 b' class localrepository(repo.repository):' | |||
|
1532 | 1527 | lheads: local branch heads |
|
1533 | 1528 | rheads: remote branch heads |
|
1534 | 1529 | ''' |
|
1535 | newlheads = [n for n in lheads if n in outgoingnodeset] | |
|
1536 | formerrheads = [n for n in rheads if n in nolongeraheadnodeset] | |
|
1537 | if len(newlheads) > len(formerrheads): | |
|
1538 | # we add more new heads than we demote former heads to non-head | |
|
1530 | ||
|
1531 | warn = 0 | |
|
1532 | ||
|
1533 | if len(lheads) > len(rheads): | |
|
1534 | warn = 1 | |
|
1535 | else: | |
|
1536 | # add local heads involved in the push | |
|
1537 | updatelheads = [self.changelog.heads(x, lheads) | |
|
1538 | for x in update] | |
|
1539 | newheads = set(sum(updatelheads, [])) & set(lheads) | |
|
1540 | ||
|
1541 | if not newheads: | |
|
1542 | return True | |
|
1543 | ||
|
1544 | # add heads we don't have or that are not involved in the push | |
|
1545 | for r in rheads: | |
|
1546 | if r in self.changelog.nodemap: | |
|
1547 | desc = self.changelog.heads(r, heads) | |
|
1548 | l = [h for h in heads if h in desc] | |
|
1549 | if not l: | |
|
1550 | newheads.add(r) | |
|
1551 | else: | |
|
1552 | newheads.add(r) | |
|
1553 | if len(newheads) > len(rheads): | |
|
1554 | warn = 1 | |
|
1555 | ||
|
1556 | if warn: | |
|
1539 | 1557 | if branchname is not None: |
|
1540 | 1558 | msg = _("abort: push creates new remote heads" |
|
1541 | 1559 | " on branch '%s'!\n") % branchname |
@@ -1599,7 +1617,7 b' class localrepository(repo.repository):' | |||
|
1599 | 1617 | |
|
1600 | 1618 | if revs is None: |
|
1601 | 1619 | # use the fast path, no race possible on push |
|
1602 | nodes = cl.findmissing(common.keys()) | |
|
1620 | nodes = self.changelog.findmissing(common.keys()) | |
|
1603 | 1621 | cg = self._changegroup(nodes, 'push') |
|
1604 | 1622 | else: |
|
1605 | 1623 | cg = self.changegroupsubset(update, revs, 'push') |
General Comments 0
You need to be logged in to leave comments.
Login now