1321 if obsolete.isenabled(repo, obsolete.exchangeopt): |
1321 if obsolete.isenabled(repo, obsolete.exchangeopt): |
1322 supportedformat = tuple('V%i' % v for v in obsolete.formats) |
1322 supportedformat = tuple('V%i' % v for v in obsolete.formats) |
1323 caps['obsmarkers'] = supportedformat |
1323 caps['obsmarkers'] = supportedformat |
1324 if allowpushback: |
1324 if allowpushback: |
1325 caps['pushback'] = () |
1325 caps['pushback'] = () |
|
1326 if not repo.ui.configbool('experimental', 'checkheads-strict', True): |
|
1327 caps['checkheads'] = ('related',) |
1326 return caps |
1328 return caps |
1327 |
1329 |
1328 def bundle2caps(remote): |
1330 def bundle2caps(remote): |
1329 """return the bundle capabilities of a peer as dict""" |
1331 """return the bundle capabilities of a peer as dict""" |
1330 raw = remote.capable('bundle2') |
1332 raw = remote.capable('bundle2') |
1601 op.gettransaction() |
1603 op.gettransaction() |
1602 if sorted(heads) != sorted(op.repo.heads()): |
1604 if sorted(heads) != sorted(op.repo.heads()): |
1603 raise error.PushRaced('repository changed while pushing - ' |
1605 raise error.PushRaced('repository changed while pushing - ' |
1604 'please try again') |
1606 'please try again') |
1605 |
1607 |
|
1608 @parthandler('check:updated-heads') |
|
1609 def handlecheckupdatedheads(op, inpart): |
|
1610 """check for race on the heads touched by a push |
|
1611 |
|
1612 This is similar to 'check:heads' but focus on the heads actually updated |
|
1613 during the push. If other activities happen on unrelated heads, it is |
|
1614 ignored. |
|
1615 |
|
1616 This allow server with high traffic to avoid push contention as long as |
|
1617 unrelated parts of the graph are involved.""" |
|
1618 h = inpart.read(20) |
|
1619 heads = [] |
|
1620 while len(h) == 20: |
|
1621 heads.append(h) |
|
1622 h = inpart.read(20) |
|
1623 assert not h |
|
1624 # trigger a transaction so that we are guaranteed to have the lock now. |
|
1625 if op.ui.configbool('experimental', 'bundle2lazylocking'): |
|
1626 op.gettransaction() |
|
1627 |
|
1628 currentheads = set() |
|
1629 for ls in op.repo.branchmap().itervalues(): |
|
1630 currentheads.update(ls) |
|
1631 |
|
1632 for h in heads: |
|
1633 if h not in currentheads: |
|
1634 raise error.PushRaced('repository changed while pushing - ' |
|
1635 'please try again') |
|
1636 |
1606 @parthandler('output') |
1637 @parthandler('output') |
1607 def handleoutput(op, inpart): |
1638 def handleoutput(op, inpart): |
1608 """forward output captured on the server to the client""" |
1639 """forward output captured on the server to the client""" |
1609 for line in inpart.read().splitlines(): |
1640 for line in inpart.read().splitlines(): |
1610 op.ui.status(_('remote: %s\n') % line) |
1641 op.ui.status(_('remote: %s\n') % line) |