hgext/mq.py
changeset 18112 569091b938a9
parent 18067 6f62e005781d
child 18143 242d2f4ec01c
equal deleted inserted replaced
18111:d7c28954d901 18112:569091b938a9
  3475                 else:
  3475                 else:
  3476                     tags[patch[1]] = patch[0]
  3476                     tags[patch[1]] = patch[0]
  3477 
  3477 
  3478             return result
  3478             return result
  3479 
  3479 
  3480         def _branchtags(self, partial, lrev):
  3480         def _cacheabletip(self):
  3481             q = self.mq
  3481             q = self.mq
  3482             cl = self.changelog
  3482             cl = self.changelog
  3483             qbase = None
  3483             qbase = None
  3484             if not q.applied:
  3484             if not q.applied:
  3485                 if getattr(self, '_committingpatch', False):
  3485                 if getattr(self, '_committingpatch', False):
  3490                 try:
  3490                 try:
  3491                     qbase = self.unfiltered().changelog.rev(qbasenode)
  3491                     qbase = self.unfiltered().changelog.rev(qbasenode)
  3492                 except error.LookupError:
  3492                 except error.LookupError:
  3493                     self.ui.warn(_('mq status file refers to unknown node %s\n')
  3493                     self.ui.warn(_('mq status file refers to unknown node %s\n')
  3494                                  % short(qbasenode))
  3494                                  % short(qbasenode))
  3495             if qbase is None:
  3495             ret = super(mqrepo, self)._cacheabletip()
  3496                 return super(mqrepo, self)._branchtags(partial, lrev)
  3496             if qbase is not None:
  3497 
  3497                 ret = min(qbase - 1, ret)
  3498             start = lrev + 1
  3498             return ret
  3499             if start < qbase:
       
  3500                 # update the cache (excluding the patches) and save it
       
  3501                 ctxgen = (self[r] for r in xrange(lrev + 1, qbase))
       
  3502                 self._updatebranchcache(partial, ctxgen)
       
  3503                 self._writebranchcache(partial, cl.node(qbase - 1), qbase - 1)
       
  3504                 start = qbase
       
  3505             # if start = qbase, the cache is as updated as it should be.
       
  3506             # if start > qbase, the cache includes (part of) the patches.
       
  3507             # we might as well use it, but we won't save it.
       
  3508 
       
  3509             # update the cache up to the tip
       
  3510             ctxgen = (self[r] for r in xrange(start, len(cl)))
       
  3511             self._updatebranchcache(partial, ctxgen)
       
  3512 
       
  3513             return partial
       
  3514 
  3499 
  3515     if repo.local():
  3500     if repo.local():
  3516         repo.__class__ = mqrepo
  3501         repo.__class__ = mqrepo
  3517 
  3502 
  3518         repo._phasedefaults.append(mqphasedefaults)
  3503         repo._phasedefaults.append(mqphasedefaults)