##// END OF EJS Templates
push: refactor and optimize prepush
Sune Foldager -
r10772:1e819576 stable
parent child Browse files
Show More
@@ -1503,30 +1503,22 b' class localrepository(repo.repository):'
1503 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1503 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1504 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1504 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1505
1505
1506 def checkbranch(lheads, rheads, updatelb, branchname=None):
1506 def checkbranch(lheads, rheads, branchname=None):
1507 '''
1507 '''
1508 check whether there are more local heads than remote heads on
1508 check whether there are more local heads than remote heads on
1509 a specific branch.
1509 a specific branch.
1510
1510
1511 lheads: local branch heads
1511 lheads: local branch heads
1512 rheads: remote branch heads
1512 rheads: remote branch heads
1513 updatelb: outgoing local branch bases
1514 '''
1513 '''
1515
1514
1516 warn = 0
1515 warn = 0
1517
1516
1518 if not revs and len(lheads) > len(rheads):
1517 if len(lheads) > len(rheads):
1519 warn = 1
1518 warn = 1
1520 else:
1519 else:
1521 # add local heads involved in the push
1522 updatelheads = [self.changelog.heads(x, lheads)
1523 for x in updatelb]
1524 newheads = set(sum(updatelheads, [])) & set(lheads)
1525
1526 if not newheads:
1527 return True
1528
1529 # add heads we don't have or that are not involved in the push
1520 # add heads we don't have or that are not involved in the push
1521 newheads = set(lheads)
1530 for r in rheads:
1522 for r in rheads:
1531 if r in self.changelog.nodemap:
1523 if r in self.changelog.nodemap:
1532 desc = self.changelog.heads(r, heads)
1524 desc = self.changelog.heads(r, heads)
@@ -1590,10 +1582,10 b' class localrepository(repo.repository):'
1590 for branch, lheads in localbrheads.iteritems():
1582 for branch, lheads in localbrheads.iteritems():
1591 if branch in remotebrheads:
1583 if branch in remotebrheads:
1592 rheads = remotebrheads[branch]
1584 rheads = remotebrheads[branch]
1593 if not checkbranch(lheads, rheads, update, branch):
1585 if not checkbranch(lheads, rheads, branch):
1594 return None, 0
1586 return None, 0
1595 else:
1587 else:
1596 if not checkbranch(heads, remote_heads, update):
1588 if not checkbranch(heads, remote_heads):
1597 return None, 0
1589 return None, 0
1598
1590
1599 if inc:
1591 if inc:
General Comments 0
You need to be logged in to leave comments. Login now