hgext3rd/topic/__init__.py
changeset 1990 71410fa2c253
parent 1989 cf9414f2b5cd
child 1991 ba79d23594d6
equal deleted inserted replaced
1989:cf9414f2b5cd 1990:71410fa2c253
   194 def topics(ui, repo, topic='', clear=False, change=None, list=False, **opts):
   194 def topics(ui, repo, topic='', clear=False, change=None, list=False, **opts):
   195     """View current topic, set current topic, or see all topics."""
   195     """View current topic, set current topic, or see all topics."""
   196     if list:
   196     if list:
   197         if clear or change:
   197         if clear or change:
   198             raise error.Abort(_("cannot use --clear or --change with --list"))
   198             raise error.Abort(_("cannot use --clear or --change with --list"))
       
   199         if not topic:
       
   200             topic = repo.currenttopic
       
   201         if not topic:
       
   202             raise error.Abort(_('no active topic to list'))
   199         return stack.showstack(ui, repo, topic, opts)
   203         return stack.showstack(ui, repo, topic, opts)
   200 
   204 
   201     if change:
   205     if change:
   202         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
   206         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
   203             raise error.Abort(_('must have obsolete enabled to use --change'))
   207             raise error.Abort(_('must have obsolete enabled to use --change'))
   273 @command('stack [TOPIC]', [] + commands.formatteropts)
   277 @command('stack [TOPIC]', [] + commands.formatteropts)
   274 def cmdstack(ui, repo, topic='', **opts):
   278 def cmdstack(ui, repo, topic='', **opts):
   275     """list all changesets in a topic
   279     """list all changesets in a topic
   276 
   280 
   277     List the current topic by default."""
   281     List the current topic by default."""
       
   282     if not topic:
       
   283         topic = repo.currenttopic
       
   284     if not topic:
       
   285         raise error.Abort(_('no active topic to list'))
   278     return stack.showstack(ui, repo, topic, opts)
   286     return stack.showstack(ui, repo, topic, opts)
   279 
   287 
   280 def _listtopics(ui, repo, opts):
   288 def _listtopics(ui, repo, opts):
   281     fm = ui.formatter('bookmarks', opts)
   289     fm = ui.formatter('bookmarks', opts)
   282     activetopic = repo.currenttopic
   290     activetopic = repo.currenttopic