src/topic/__init__.py
changeset 1895 c8e4c6e03957
parent 1894 f8ee36489d3c
equal deleted inserted replaced
1894:f8ee36489d3c 1895:c8e4c6e03957
    36 from mercurial import wireproto
    36 from mercurial import wireproto
    37 
    37 
    38 from . import constants
    38 from . import constants
    39 from . import revset as topicrevset
    39 from . import revset as topicrevset
    40 from . import destination
    40 from . import destination
       
    41 from . import stack
    41 from . import topicmap
    42 from . import topicmap
    42 from . import discovery
    43 from . import discovery
    43 
    44 
    44 cmdtable = {}
    45 cmdtable = {}
    45 command = cmdutil.command(cmdtable)
    46 command = cmdutil.command(cmdtable)
   163             listnames=lambda repo: repo.topics))
   164             listnames=lambda repo: repo.topics))
   164 
   165 
   165 @command('topics [TOPIC]', [
   166 @command('topics [TOPIC]', [
   166     ('', 'clear', False, 'clear active topic if any'),
   167     ('', 'clear', False, 'clear active topic if any'),
   167     ('', 'change', '', 'revset of existing revisions to change topic'),
   168     ('', 'change', '', 'revset of existing revisions to change topic'),
       
   169     ('l', 'list', False, 'show the stack of changeset in the topic'),
   168 ])
   170 ])
   169 def topics(ui, repo, topic='', clear=False, change=None):
   171 def topics(ui, repo, topic='', clear=False, change=None, list=False):
   170     """View current topic, set current topic, or see all topics."""
   172     """View current topic, set current topic, or see all topics."""
       
   173     if list:
       
   174         if clear or change:
       
   175             raise error.Abort(_("cannot use --clear or --change with --list"))
       
   176         return stack.showstack(ui, repo, topic)
       
   177 
   171     if change:
   178     if change:
   172         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
   179         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
   173             raise error.Abort(_('must have obsolete enabled to use --change'))
   180             raise error.Abort(_('must have obsolete enabled to use --change'))
   174         if not topic and not clear:
   181         if not topic and not clear:
   175             raise error.Abort('changing topic requires a topic name or --clear')
   182             raise error.Abort('changing topic requires a topic name or --clear')