mercurial/localrepo.py
changeset 15818 57241845a4bb
parent 15735 5b384b7f48d5
child 15820 2673006f7989
equal deleted inserted replaced
15817:8f377751b510 15818:57241845a4bb
   179         phases.filterunknown(self, phaseroots)
   179         phases.filterunknown(self, phaseroots)
   180         return phaseroots
   180         return phaseroots
   181 
   181 
   182     @propertycache
   182     @propertycache
   183     def _phaserev(self):
   183     def _phaserev(self):
   184         cache = [0] * len(self)
   184         cache = [phases.public] * len(self)
   185         for phase in phases.trackedphases:
   185         for phase in phases.trackedphases:
   186             roots = map(self.changelog.rev, self._phaseroots[phase])
   186             roots = map(self.changelog.rev, self._phaseroots[phase])
   187             if roots:
   187             if roots:
   188                 for rev in roots:
   188                 for rev in roots:
   189                     cache[rev] = phase
   189                     cache[rev] = phase
  1251             xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
  1251             xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
  1252             self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
  1252             self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
  1253                       parent2=xp2, pending=p)
  1253                       parent2=xp2, pending=p)
  1254             self.changelog.finalize(trp)
  1254             self.changelog.finalize(trp)
  1255             # set the new commit is proper phase
  1255             # set the new commit is proper phase
  1256             targetphase = self.ui.configint('phases', 'new-commit', 1)
  1256             targetphase = self.ui.configint('phases', 'new-commit',
       
  1257                                             phases.draft)
  1257             if targetphase:
  1258             if targetphase:
  1258                 # retract boundary do not alter parent changeset.
  1259                 # retract boundary do not alter parent changeset.
  1259                 # if a parent have higher the resulting phase will
  1260                 # if a parent have higher the resulting phase will
  1260                 # be compliant anyway
  1261                 # be compliant anyway
  1261                 #
  1262                 #
  1552                 for phase, boundary in enumerate(rheads):
  1553                 for phase, boundary in enumerate(rheads):
  1553                     phases.advanceboundary(self, phase, boundary)
  1554                     phases.advanceboundary(self, phase, boundary)
  1554             else:
  1555             else:
  1555                 # Remote is old or publishing all common changesets
  1556                 # Remote is old or publishing all common changesets
  1556                 # should be seen as public
  1557                 # should be seen as public
  1557                 phases.advanceboundary(self, 0, common + added)
  1558                 phases.advanceboundary(self, phases.public, common + added)
  1558         finally:
  1559         finally:
  1559             lock.release()
  1560             lock.release()
  1560 
  1561 
  1561         return result
  1562         return result
  1562 
  1563 
  1613                         ret = remote.addchangegroup(cg, 'push', self.url())
  1614                         ret = remote.addchangegroup(cg, 'push', self.url())
  1614 
  1615 
  1615                 # even when we don't push, exchanging phase data is useful
  1616                 # even when we don't push, exchanging phase data is useful
  1616                 remotephases = remote.listkeys('phases')
  1617                 remotephases = remote.listkeys('phases')
  1617                 if not remotephases: # old server or public only repo
  1618                 if not remotephases: # old server or public only repo
  1618                     phases.advanceboundary(self, 0, fut)
  1619                     phases.advanceboundary(self, phases.public, fut)
  1619                     # don't push any phase data as there is nothing to push
  1620                     # don't push any phase data as there is nothing to push
  1620                 else:
  1621                 else:
  1621                     ana = phases.analyzeremotephases(self, fut, remotephases)
  1622                     ana = phases.analyzeremotephases(self, fut, remotephases)
  1622                     rheads, rroots = ana
  1623                     rheads, rroots = ana
  1623                     ### Apply remote phase on local
  1624                     ### Apply remote phase on local
  1624                     if remotephases.get('publishing', False):
  1625                     if remotephases.get('publishing', False):
  1625                         phases.advanceboundary(self, 0, fut)
  1626                         phases.advanceboundary(self, phases.public, fut)
  1626                     else: # publish = False
  1627                     else: # publish = False
  1627                         for phase, rpheads in enumerate(rheads):
  1628                         for phase, rpheads in enumerate(rheads):
  1628                             phases.advanceboundary(self, phase, rpheads)
  1629                             phases.advanceboundary(self, phase, rpheads)
  1629                     ### Apply local phase on remote
  1630                     ### Apply local phase on remote
  1630                     #
  1631                     #
  2055             added = [cl.node(r) for r in xrange(clstart, clend)]
  2056             added = [cl.node(r) for r in xrange(clstart, clend)]
  2056             publishing = self.ui.configbool('phases', 'publish', True)
  2057             publishing = self.ui.configbool('phases', 'publish', True)
  2057             if publishing and srctype == 'push':
  2058             if publishing and srctype == 'push':
  2058                 # Old server can not push the boundary themself.
  2059                 # Old server can not push the boundary themself.
  2059                 # This clause ensure pushed changeset are alway marked as public
  2060                 # This clause ensure pushed changeset are alway marked as public
  2060                 phases.advanceboundary(self, 0, added)
  2061                 phases.advanceboundary(self, phases.public, added)
  2061             elif srctype != 'strip': # strip should not touch boundary at all
  2062             elif srctype != 'strip': # strip should not touch boundary at all
  2062                 phases.retractboundary(self, 1, added)
  2063                 phases.retractboundary(self, phases.draft, added)
  2063 
  2064 
  2064             # make changelog see real files again
  2065             # make changelog see real files again
  2065             cl.finalize(trp)
  2066             cl.finalize(trp)
  2066 
  2067 
  2067             tr.close()
  2068             tr.close()