diff hgext3rd/topic/stack.py @ 2627:42abd3bd30ee

topics: abort if user wants to show the stack of a non-existent topic
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 19 Jun 2017 03:13:35 +0530
parents bc36a608e9e4
children 62eb5a2d2112
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Mon Jun 19 02:50:35 2017 +0530
+++ b/hgext3rd/topic/stack.py	Mon Jun 19 03:13:35 2017 +0530
@@ -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 = []