changeset 2780:90e11985d0cc

topic: exclude public and topic changeset from branch stack Stack use-case is to show the current work in progress, which are symbolized by the phase draft and secret phase. Moreover showing public changesets in stack output when displaying current branch would display a lot of changesets for long-lived branches and would be quite useless. We also exclude topic changeset form the stack since they already exist on their own stack. getstack revsets didn't needed update when displaying a topic as when a changeset become public, its topic is no longer relevant.
author Boris Feld <boris.feld@octobus.net>
date Thu, 29 Jun 2017 16:49:33 +0200
parents d22090c6e68f
children 008f7cd1fcbe
files hgext3rd/topic/stack.py tests/test-stack-branch.t tests/test-topic-stack.t
diffstat 3 files changed, 39 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py
+++ b/hgext3rd/topic/stack.py
@@ -17,7 +17,7 @@
     elif topic is not None:
         trevs = repo.revs("topic(%s) - obsolete()", topic)
     elif branch is not None:
-        trevs = repo.revs("branch(%s) - obsolete()", branch)
+        trevs = repo.revs("branch(%s) - public() - obsolete() - topic()", branch)
     else:
         raise error.ProgrammingError('neither branch and topic specified (not defined yet)')
     return _orderrevs(repo, trevs)
--- a/tests/test-stack-branch.t
+++ b/tests/test-stack-branch.t
@@ -251,3 +251,39 @@
   b1: c_c
     ^ c_b
 
+Check that stack doesn't show draft changesets on a branch
+----------------------------------------------------------
+
+  $ hg stack
+  ### branch: foo (2 heads)
+  b6$ c_f (unstable)
+  b5$ c_e (unstable)
+  b2^ c_D (base)
+  b4: c_h
+  b3: c_g
+  b2@ c_D (current)
+  b1: c_c
+    ^ c_b
+  $ hg phase --public b1
+  $ hg stack
+  ### branch: foo (2 heads)
+  b5$ c_f (unstable)
+  b4$ c_e (unstable)
+  b1^ c_D (base)
+  b3: c_h
+  b2: c_g
+  b1@ c_D (current)
+    ^ c_c
+
+Check that stack doesn't show changeset with a topic
+----------------------------------------------------
+
+  $ hg topic --rev b4::b5 sometopic
+  changed topic on 2 changes
+  please run hg evolve --rev "topic(sometopic)" now
+  $ hg stack
+  ### branch: foo
+  b3: c_h
+  b2: c_g
+  b1@ c_D (current)
+    ^ c_c
--- a/tests/test-topic-stack.t
+++ b/tests/test-topic-stack.t
@@ -129,13 +129,7 @@
 
   $ hg topic --clear
   $ hg stack
-  ### branch: default
-  b6@ c_f (current)
-  b5: c_e
-  b4: c_d
-  b3: c_c
-  b2: c_b
-  b1: c_a
+  ### branch: 
 
 Test "t#" reference
 -------------------
@@ -340,3 +334,4 @@
   $ hg topic --list thisdoesnotexist
   abort: cannot resolve "thisdoesnotexist": no such topic found
   [255]
+