topic: don't abort if there is no current topic in stack() revset
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 29 Jun 2017 02:21:09 +0530
changeset 2682 a6e3c2fcb1d7
parent 2681 aa4db71a6224
child 2683 d22090c6e68f
topic: don't abort if there is no current topic in stack() revset Named branches support has been added and we should not abort if there is no active topic.
hgext3rd/topic/revset.py
tests/test-stack-branch.t
--- a/hgext3rd/topic/revset.py	Thu Jun 29 01:58:26 2017 +0530
+++ b/hgext3rd/topic/revset.py	Thu Jun 29 02:21:09 2017 +0530
@@ -1,8 +1,6 @@
 from __future__ import absolute_import
 
-from mercurial.i18n import _
 from mercurial import (
-    error,
     phases,
     revset,
     util,
@@ -74,9 +72,6 @@
     err = 'stack() takes no argument, it works on current topic'
     revset.getargs(x, 0, 0, err)
     topic = repo.currenttopic
-    if not topic:
-        raise error.Abort(_('no active topic to list'))
-    # ordering hack, boo
     topic = None
     branch = None
     if not topic and repo.currenttopic:
--- a/tests/test-stack-branch.t	Thu Jun 29 01:58:26 2017 +0530
+++ b/tests/test-stack-branch.t	Thu Jun 29 02:21:09 2017 +0530
@@ -139,8 +139,10 @@
 Also test the revset:
 
   $ hg log -r 'stack()'
-  abort: no active topic to list
-  [255]
+  2 foo {} draft c_c
+  7 foo {} draft c_d
+  4 foo {} draft c_e
+  5 foo {} draft c_f
 
 Case with multiple heads on the topic
 -------------------------------------