Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 15650:5b26667fc4d3
phases: exchange phase boundaries on pull
Add an extra argument to addchangegroup to all phase code to execute before the
lock is released.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 15 Dec 2011 11:28:42 +0100 |
parents | 218ec96c45d7 |
children | e69a3cdad37e |
comparison
equal
deleted
inserted
replaced
15649:ca7c4254a21a | 15650:5b26667fc4d3 |
---|---|
1505 tmp = discovery.findcommonincoming(self, remote, heads=heads, | 1505 tmp = discovery.findcommonincoming(self, remote, heads=heads, |
1506 force=force) | 1506 force=force) |
1507 common, fetch, rheads = tmp | 1507 common, fetch, rheads = tmp |
1508 if not fetch: | 1508 if not fetch: |
1509 self.ui.status(_("no changes found\n")) | 1509 self.ui.status(_("no changes found\n")) |
1510 added = [] | |
1510 result = 0 | 1511 result = 0 |
1511 else: | 1512 else: |
1512 if heads is None and list(common) == [nullid]: | 1513 if heads is None and list(common) == [nullid]: |
1513 self.ui.status(_("requesting all changes\n")) | 1514 self.ui.status(_("requesting all changes\n")) |
1514 elif heads is None and remote.capable('changegroupsubset'): | 1515 elif heads is None and remote.capable('changegroupsubset'): |
1524 raise util.Abort(_("partial pull cannot be done because " | 1525 raise util.Abort(_("partial pull cannot be done because " |
1525 "other repository doesn't support " | 1526 "other repository doesn't support " |
1526 "changegroupsubset.")) | 1527 "changegroupsubset.")) |
1527 else: | 1528 else: |
1528 cg = remote.changegroupsubset(fetch, heads, 'pull') | 1529 cg = remote.changegroupsubset(fetch, heads, 'pull') |
1530 clstart = len(self.changelog) | |
1529 result = self.addchangegroup(cg, 'pull', remote.url()) | 1531 result = self.addchangegroup(cg, 'pull', remote.url()) |
1530 phases.advanceboundary(self, 0, common) | 1532 clend = len(self.changelog) |
1533 added = [self.changelog.node(r) for r in xrange(clstart, clend)] | |
1534 | |
1535 | |
1536 # Get remote phases data from remote | |
1537 remotephases = remote.listkeys('phases') | |
1538 publishing = bool(remotephases.get('publishing', False)) | |
1539 if remotephases and not publishing: | |
1540 # remote is new and unpublishing | |
1541 subset = common + added | |
1542 rheads, rroots = phases.analyzeremotephases(self, subset, | |
1543 remotephases) | |
1544 for phase, boundary in enumerate(rheads): | |
1545 phases.advanceboundary(self, phase, boundary) | |
1546 else: | |
1547 # Remote is old or publishing all common changesets | |
1548 # should be seen as public | |
1549 phases.advanceboundary(self, 0, common + added) | |
1531 finally: | 1550 finally: |
1532 lock.release() | 1551 lock.release() |
1533 | 1552 |
1534 return result | 1553 return result |
1535 | 1554 |