hgext3rd/topic/__init__.py
changeset 3057 cb8ae3cb0bbc
parent 3040 a05b6580f71c
parent 3048 bdc28886526f
child 3059 02b220984b01
equal deleted inserted replaced
3055:774b4ea6ca58 3057:cb8ae3cb0bbc
   137               'log.topic': 'green_background',
   137               'log.topic': 'green_background',
   138               'topic.active': 'green',
   138               'topic.active': 'green',
   139              }
   139              }
   140 
   140 
   141 __version__ = '0.4.0.dev'
   141 __version__ = '0.4.0.dev'
       
   142 
   142 testedwith = '4.0.2 4.1.3 4.2.3 4.3.3'
   143 testedwith = '4.0.2 4.1.3 4.2.3 4.3.3'
   143 minimumhgversion = '4.0'
   144 minimumhgversion = '4.0'
   144 buglink = 'https://bz.mercurial-scm.org/'
   145 buglink = 'https://bz.mercurial-scm.org/'
   145 
   146 
   146 def _contexttopic(self, force=False):
   147 def _contexttopic(self, force=False):
   336 
   337 
   337             # real transaction start
   338             # real transaction start
   338             ct = self.currenttopic
   339             ct = self.currenttopic
   339             if not ct:
   340             if not ct:
   340                 return tr
   341                 return tr
   341             ctwasempty = stack.stackdata(self, topic=ct)['changesetcount'] == 0
   342             ctwasempty = stack.stack(self, topic=ct).changesetcount == 0
   342 
   343 
   343             reporef = weakref.ref(self)
   344             reporef = weakref.ref(self)
   344 
   345 
   345             def currenttopicempty(tr):
   346             def currenttopicempty(tr):
   346                 # check active topic emptyness
   347                 # check active topic emptyness
   347                 repo = reporef()
   348                 repo = reporef()
   348                 csetcount = stack.stackdata(repo, topic=ct)['changesetcount']
   349                 csetcount = stack.stack(repo, topic=ct).changesetcount
   349                 empty = csetcount == 0
   350                 empty = csetcount == 0
   350                 if empty and not ctwasempty:
   351                 if empty and not ctwasempty:
   351                     ui.status('active topic %r is now empty\n' % ct)
   352                     ui.status('active topic %r is now empty\n' % ct)
   352                 if ctwasempty and not empty:
   353                 if ctwasempty and not empty:
   353                     if csetcount == 1:
   354                     if csetcount == 1:
   494             repo.invalidate()
   495             repo.invalidate()
   495         return
   496         return
   496 
   497 
   497     ct = repo.currenttopic
   498     ct = repo.currenttopic
   498     if clear:
   499     if clear:
   499         empty = stack.stackdata(repo, topic=ct)['changesetcount'] == 0
   500         empty = stack.stack(repo, topic=ct).changesetcount == 0
   500         if empty:
   501         if empty:
   501             if ct:
   502             if ct:
   502                 ui.status(_('clearing empty topic "%s"\n') % ct)
   503                 ui.status(_('clearing empty topic "%s"\n') % ct)
   503         return _changecurrenttopic(repo, None)
   504         return _changecurrenttopic(repo, None)
   504 
   505 
   992         # current topic. This is right for merge but wrong for rebase. We check
   993         # current topic. This is right for merge but wrong for rebase. We check
   993         # if rebase is running and update the currenttopic to topic of new
   994         # if rebase is running and update the currenttopic to topic of new
   994         # rebased commit. We have explicitly stored in config if rebase is
   995         # rebased commit. We have explicitly stored in config if rebase is
   995         # running.
   996         # running.
   996         ot = repo.currenttopic
   997         ot = repo.currenttopic
   997         empty = stack.stackdata(repo, topic=ot)['changesetcount'] == 0
   998         empty = stack.stack(repo, topic=ot).changesetcount == 0
   998         if repo.ui.hasconfig('experimental', 'topicrebase'):
   999         if repo.ui.hasconfig('experimental', 'topicrebase'):
   999             isrebase = True
  1000             isrebase = True
  1000         if repo.ui.configbool('_internal', 'keep-topic'):
  1001         if repo.ui.configbool('_internal', 'keep-topic'):
  1001             ist0 = True
  1002             ist0 = True
  1002         if ((not partial and not branchmerge) or isrebase) and not ist0:
  1003         if ((not partial and not branchmerge) or isrebase) and not ist0: