changeset 2868:e46b68547017

topic: make --clear + topicname invalid The two flags are mutually exclusive.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 28 Aug 2017 17:35:44 +0200
parents 5c0b6af37b21
children b629874ccaac
files hgext3rd/topic/__init__.py tests/test-topic.t
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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