hgext3rd/topic/__init__.py
changeset 2990 c2102598adf5
parent 2989 53246d237373
parent 2988 62201935e1a7
child 2991 f4956eb3a456
equal deleted inserted replaced
2989:53246d237373 2990:c2102598adf5
   311                         return self._repo.branchmap(topic=usetopic)
   311                         return self._repo.branchmap(topic=usetopic)
   312                 peer.__class__ = topicpeer
   312                 peer.__class__ = topicpeer
   313             return peer
   313             return peer
   314 
   314 
   315         def transaction(self, desc, *a, **k):
   315         def transaction(self, desc, *a, **k):
       
   316             ctr = self.currenttransaction()
   316             tr = super(topicrepo, self).transaction(desc, *a, **k)
   317             tr = super(topicrepo, self).transaction(desc, *a, **k)
   317             if desc == 'strip':
   318             if desc is 'strip' or ctr is not None:
   318                 return tr
   319                 return tr
       
   320 
       
   321             # real transaction start
       
   322             ct = self.currenttopic
       
   323             if not ct:
       
   324                 return tr
       
   325             ctwasempty = stack.stackdata(self, topic=ct)['changesetcount'] == 0
   319 
   326 
   320             reporef = weakref.ref(self)
   327             reporef = weakref.ref(self)
   321 
   328 
   322             def currenttopicempty(tr):
   329             def currenttopicempty(tr):
   323                 # check active topic emptyness
   330                 # check active topic emptyness
   324                 ct = self.currenttopic
       
   325                 if not ct:
       
   326                     return
       
   327                 repo = reporef()
   331                 repo = reporef()
   328                 empty = stack.stackdata(repo, topic=ct)['changesetcount'] == 0
   332                 csetcount = stack.stackdata(repo, topic=ct)['changesetcount']
   329                 if empty:
   333                 empty = csetcount == 0
       
   334                 if empty and not ctwasempty:
   330                     ui.status('active topic %r is now empty\n' % ct)
   335                     ui.status('active topic %r is now empty\n' % ct)
       
   336                 if ctwasempty and not empty:
       
   337                     if csetcount == 1:
       
   338                         msg = _('active topic %r grew its first changeset\n')
       
   339                         ui.status(msg % ct)
       
   340                     else:
       
   341                         msg = _('active topic %r grew its %s first changesets\n')
       
   342                         ui.status(msg % (ct, csetcount))
   331 
   343 
   332             tr.addpostclose('signalcurrenttopicempty', currenttopicempty)
   344             tr.addpostclose('signalcurrenttopicempty', currenttopicempty)
   333             return tr
   345             return tr
   334 
   346 
   335     repo.__class__ = topicrepo
   347     repo.__class__ = topicrepo