stack: exclude obsolete changeset from the set
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 14 Mar 2016 17:48:31 +0000
changeset 1896 4ae421cbb07c
parent 1895 c8e4c6e03957
child 1897 38570c53b1cf
stack: exclude obsolete changeset from the set We care about relevant changeset, obsolete have a new version somewhere and we don't care about the old one in our display. In case of unstability, the ordering used is still wrong.
src/topic/stack.py
tests/test-topic-stack.t
--- a/src/topic/stack.py	Mon Mar 14 17:37:39 2016 +0000
+++ b/src/topic/stack.py	Mon Mar 14 17:48:31 2016 +0000
@@ -6,9 +6,8 @@
 from mercurial import error
 
 def _getstack(repo, topic):
-    # XXX need to exclude obsolete changesets
     # XXX need sorting
-    return repo.revs("topic(%s)", topic)
+    return repo.revs("topic(%s) - obsolete()", topic)
 
 def showstack(ui, repo, topic):
     if not topic:
--- a/tests/test-topic-stack.t	Mon Mar 14 17:37:39 2016 +0000
+++ b/tests/test-topic-stack.t	Mon Mar 14 17:48:31 2016 +0000
@@ -6,6 +6,8 @@
   $ cat << EOF >> $HGRCPATH
   > [ui]
   > logtemplate = {rev} {branch} \{{get(namespaces, "topics")}} {phase} {desc|firstline}\n
+  > [experimental]
+  > evolution=createmarkers,exchange,allowunstable
   > EOF
 
 (new head warning seems buggy)
@@ -66,3 +68,32 @@
   $ hg topic --list
   abort: no active topic to list
   [255]
+
+Case with some of the topic unstable
+------------------------------------
+
+  $ hg up 'desc(c_d)'
+  switching to topic foo
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bbb > ddd
+  $ hg commit --amend
+  $ hg log -G
+  @  7 default {foo} draft c_d
+  |
+  | o  5 default {foo} draft c_f
+  | |
+  | o  4 default {foo} draft c_e
+  | |
+  | x  3 default {foo} draft c_d
+  |/
+  o  2 default {foo} draft c_c
+  |
+  o  1 default {} draft c_b
+  |
+  o  0 default {} draft c_a
+  
+  $ hg topic --list
+  c_c
+  c_e
+  c_f
+  c_d