hgext3rd/topic/__init__.py
changeset 1907 95874e8fc5f2
parent 1904 f52c02bf47b7
child 1908 dbd6d51e63f1
equal deleted inserted replaced
1906:5e9ce6310720 1907:95874e8fc5f2
    52     return self.extra().get(constants.extrakey, '')
    52     return self.extra().get(constants.extrakey, '')
    53 context.basectx.topic = _contexttopic
    53 context.basectx.topic = _contexttopic
    54 
    54 
    55 topicrev = re.compile(r'^t\d+$')
    55 topicrev = re.compile(r'^t\d+$')
    56 
    56 
    57 
       
    58 def _namemap(repo, name):
    57 def _namemap(repo, name):
    59     if topicrev.match(name):
    58     if topicrev.match(name):
    60         idx = int(name[1:])
    59         idx = int(name[1:])
    61         topic = repo.currenttopic
    60         topic = repo.currenttopic
    62         if not topic:
    61         if not topic:
   187 
   186 
   188 @command('topics [TOPIC]', [
   187 @command('topics [TOPIC]', [
   189     ('', 'clear', False, 'clear active topic if any'),
   188     ('', 'clear', False, 'clear active topic if any'),
   190     ('', 'change', '', 'revset of existing revisions to change topic'),
   189     ('', 'change', '', 'revset of existing revisions to change topic'),
   191     ('l', 'list', False, 'show the stack of changeset in the topic'),
   190     ('l', 'list', False, 'show the stack of changeset in the topic'),
   192 ])
   191     ] + commands.formatteropts)
   193 def topics(ui, repo, topic='', clear=False, change=None, list=False):
   192 def topics(ui, repo, topic='', clear=False, change=None, list=False, **opts):
   194     """View current topic, set current topic, or see all topics."""
   193     """View current topic, set current topic, or see all topics."""
   195     if list:
   194     if list:
   196         if clear or change:
   195         if clear or change:
   197             raise error.Abort(_("cannot use --clear or --change with --list"))
   196             raise error.Abort(_("cannot use --clear or --change with --list"))
   198         return stack.showstack(ui, repo, topic)
   197         return stack.showstack(ui, repo, topic, opts)
   199 
   198 
   200     if change:
   199     if change:
   201         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
   200         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
   202             raise error.Abort(_('must have obsolete enabled to use --change'))
   201             raise error.Abort(_('must have obsolete enabled to use --change'))
   203         if not topic and not clear:
   202         if not topic and not clear: