topic: make --clear + topicname invalid
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 28 Aug 2017 17:35:44 +0200
changeset 2868 e46b68547017
parent 2867 5c0b6af37b21
child 2869 b629874ccaac
topic: make --clear + topicname invalid The two flags are mutually exclusive.
hgext3rd/topic/__init__.py
tests/test-topic.t
--- a/hgext3rd/topic/__init__.py	Mon Aug 28 17:15:08 2017 +0200
+++ b/hgext3rd/topic/__init__.py	Mon Aug 28 17:35:44 2017 +0200
@@ -345,6 +345,8 @@
         raise error.Abort(_("cannot use --current when setting a topic"))
     if current and clear:
         raise error.Abort(_("cannot use --current and --clear"))
+    if clear and topic:
+        raise error.Abort(_("cannot use --clear when setting a topic"))
 
     if list:
         if clear or rev:
--- a/tests/test-topic.t	Mon Aug 28 17:15:08 2017 +0200
+++ b/tests/test-topic.t	Mon Aug 28 17:35:44 2017 +0200
@@ -82,6 +82,9 @@
   $ hg topics --current --clear
   abort: cannot use --current and --clear
   [255]
+  $ hg topics --clear somerandomtopic
+  abort: cannot use --clear when setting a topic
+  [255]
 
 Test commit flag and help text