Re: [PATCH 5 of 5 topic-experiment] topics: abort if user wants to show the stack of a non-existent topic

2017-06-19 Thread Pierre-Yves David

I've taken the whole series Thanks!

There is still multiple unsolved issue around issue5441, but patch2 make 
things move forward so I've taken it. See comment on this specific patch 
for details.


On 06/19/2017 12:12 AM, Pulkit Goyal wrote:

# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1497822215 -19800
#  Mon Jun 19 03:13:35 2017 +0530
# Node ID 8d8ac3adc1f9e03625d293ae78f250b115154d94
# Parent  83df91589000c05359805c96fa84a3995896ee3c
topics: abort if user wants to show the stack of a non-existent topic

diff --git a/hgext3rd/topic/stack.py b/hgext3rd/topic/stack.py
--- a/hgext3rd/topic/stack.py
+++ b/hgext3rd/topic/stack.py
@@ -22,6 +22,10 @@
 return ' '.join(prefix % suffix for suffix in labelssuffix)

 def showstack(ui, repo, topic, opts):
+
+if topic not in repo.topics:
+raise error.Abort(_('cannot resolve "%s": no such topic found') % 
topic)
+
 fm = ui.formatter('topicstack', opts)
 prev = None
 entries = []
diff --git a/tests/test-topic-stack.t b/tests/test-topic-stack.t
--- a/tests/test-topic-stack.t
+++ b/tests/test-topic-stack.t
@@ -319,3 +319,11 @@
   t2@ c_D (current)
   t1: c_c
 ^ c_b
+
+Trying to list non existing topic
+  $ hg stack thisdoesnotexist
+  abort: cannot resolve "thisdoesnotexist": no such topic found
+  [255]
+  $ hg topic --list thisdoesnotexist
+  abort: cannot resolve "thisdoesnotexist": no such topic found
+  [255]
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



--
Pierre-Yves David
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 5 topic-experiment] topics: abort if user wants to show the stack of a non-existent topic

2017-06-18 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1497822215 -19800
#  Mon Jun 19 03:13:35 2017 +0530
# Node ID 8d8ac3adc1f9e03625d293ae78f250b115154d94
# Parent  83df91589000c05359805c96fa84a3995896ee3c
topics: abort if user wants to show the stack of a non-existent topic

diff --git a/hgext3rd/topic/stack.py b/hgext3rd/topic/stack.py
--- a/hgext3rd/topic/stack.py
+++ b/hgext3rd/topic/stack.py
@@ -22,6 +22,10 @@
 return ' '.join(prefix % suffix for suffix in labelssuffix)
 
 def showstack(ui, repo, topic, opts):
+
+if topic not in repo.topics:
+raise error.Abort(_('cannot resolve "%s": no such topic found') % 
topic)
+
 fm = ui.formatter('topicstack', opts)
 prev = None
 entries = []
diff --git a/tests/test-topic-stack.t b/tests/test-topic-stack.t
--- a/tests/test-topic-stack.t
+++ b/tests/test-topic-stack.t
@@ -319,3 +319,11 @@
   t2@ c_D (current)
   t1: c_c
 ^ c_b
+
+Trying to list non existing topic
+  $ hg stack thisdoesnotexist
+  abort: cannot resolve "thisdoesnotexist": no such topic found
+  [255]
+  $ hg topic --list thisdoesnotexist
+  abort: cannot resolve "thisdoesnotexist": no such topic found
+  [255]
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel