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.
--- 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