changeset 1898:2b65c5a6591c

task: add index number to the output We are doing to use these number for easy movement in later changesets. The numbering will probably evolve over time but this is a good start.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 14 Mar 2016 18:24:33 +0000
parents 38570c53b1cf
children b65f39791f92
files src/topic/stack.py tests/test-topic-stack.t
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/topic/stack.py	Mon Mar 14 18:11:52 2016 +0000
+++ b/src/topic/stack.py	Mon Mar 14 18:24:33 2016 +0000
@@ -18,10 +18,10 @@
         topic = repo.currenttopic
     if not topic:
         raise error.Abort(_('no active topic to list'))
-    for r in _getstack(repo, topic):
+    for idx, r in enumerate(_getstack(repo, topic)):
         # super crude initial version
-        ui.write(repo[r].description().splitlines()[0] + '\n')
-
+        l = "%d: %s\n" % (idx, repo[r].description().splitlines()[0])
+        ui.write(l)
 
 # Copied from evolve 081605c2e9b6
 
--- a/tests/test-topic-stack.t	Mon Mar 14 18:11:52 2016 +0000
+++ b/tests/test-topic-stack.t	Mon Mar 14 18:24:33 2016 +0000
@@ -57,10 +57,10 @@
   $ hg topic
    * foo
   $ hg topic --list
-  c_c
-  c_d
-  c_e
-  c_f
+  0: c_c
+  1: c_d
+  2: c_e
+  3: c_f
 
 error case, nothing to list
 
@@ -93,7 +93,7 @@
   o  0 default {} draft c_a
   
   $ hg topic --list
-  c_c
-  c_d
-  c_e
-  c_f
+  0: c_c
+  1: c_d
+  2: c_e
+  3: c_f