comparison mercurial/localrepo.py @ 7460:3342e6ada4b9

push: use the fast changegroup() path on push The race doesn't happen on push (because the discovery is done in the same hg process), so use the fast path instead.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 02 Dec 2008 19:36:43 +0100
parents 5e13df32fb74
children f1af59451c0c
comparison
equal deleted inserted replaced
7459:3fb5c142a9f0 7460:3342e6ada4b9
1494 if remote.capable('unbundle'): 1494 if remote.capable('unbundle'):
1495 return self.push_unbundle(remote, force, revs) 1495 return self.push_unbundle(remote, force, revs)
1496 return self.push_addchangegroup(remote, force, revs) 1496 return self.push_addchangegroup(remote, force, revs)
1497 1497
1498 def prepush(self, remote, force, revs): 1498 def prepush(self, remote, force, revs):
1499 base = {} 1499 common = {}
1500 remote_heads = remote.heads() 1500 remote_heads = remote.heads()
1501 inc = self.findincoming(remote, base, remote_heads, force=force) 1501 inc = self.findincoming(remote, common, remote_heads, force=force)
1502 1502
1503 update, updated_heads = self.findoutgoing(remote, base, remote_heads) 1503 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1504 if revs is not None: 1504 if revs is not None:
1505 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) 1505 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1506 else: 1506 else:
1507 bases, heads = update, self.changelog.heads() 1507 bases, heads = update, self.changelog.heads()
1508 1508
1544 elif inc: 1544 elif inc:
1545 self.ui.warn(_("note: unsynced remote changes!\n")) 1545 self.ui.warn(_("note: unsynced remote changes!\n"))
1546 1546
1547 1547
1548 if revs is None: 1548 if revs is None:
1549 cg = self.changegroup(update, 'push') 1549 # use the fast path, no race possible on push
1550 cg = self._changegroup(common.keys(), 'push')
1550 else: 1551 else:
1551 cg = self.changegroupsubset(update, revs, 'push') 1552 cg = self.changegroupsubset(update, revs, 'push')
1552 return cg, remote_heads 1553 return cg, remote_heads
1553 1554
1554 def push_addchangegroup(self, remote, force, revs): 1555 def push_addchangegroup(self, remote, force, revs):