diff src/topic/__init__.py @ 1895:c8e4c6e03957

stack: add a very first version of stack display with 'hg topic --list' This mark the first step toward a set of feature dedicated to displaying and moving within the current stack of work. Everything is still super basic so don't look too much at the feature. The goals of this changeset are: * having a flag to trigger the feature * having a basic (imperfect selection mechanism)
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 14 Mar 2016 17:37:39 +0000
parents f8ee36489d3c
children
line wrap: on
line diff
--- a/src/topic/__init__.py	Mon Mar 14 17:09:02 2016 +0000
+++ b/src/topic/__init__.py	Mon Mar 14 17:37:39 2016 +0000
@@ -38,6 +38,7 @@
 from . import constants
 from . import revset as topicrevset
 from . import destination
+from . import stack
 from . import topicmap
 from . import discovery
 
@@ -165,9 +166,15 @@
 @command('topics [TOPIC]', [
     ('', 'clear', False, 'clear active topic if any'),
     ('', 'change', '', 'revset of existing revisions to change topic'),
+    ('l', 'list', False, 'show the stack of changeset in the topic'),
 ])
-def topics(ui, repo, topic='', clear=False, change=None):
+def topics(ui, repo, topic='', clear=False, change=None, list=False):
     """View current topic, set current topic, or see all topics."""
+    if list:
+        if clear or change:
+            raise error.Abort(_("cannot use --clear or --change with --list"))
+        return stack.showstack(ui, repo, topic)
+
     if change:
         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
             raise error.Abort(_('must have obsolete enabled to use --change'))