changeset 2995:dbc896a7a1c3

topics: make sure user don't pass both the age option and a topic name
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 25 Sep 2017 03:30:56 +0530
parents 1e8ac0fcd6b7
children 7cc79fc0e637
files hgext3rd/topic/__init__.py tests/test-topic.t
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Mon Sep 25 03:29:45 2017 +0530
+++ b/hgext3rd/topic/__init__.py	Mon Sep 25 03:30:56 2017 +0530
@@ -423,6 +423,7 @@
     list = opts.get('list')
     rev = opts.get('rev')
     current = opts.get('current')
+    age = opts.get('age')
 
     if current and topic:
         raise error.Abort(_("cannot use --current when setting a topic"))
@@ -430,6 +431,8 @@
         raise error.Abort(_("cannot use --current and --clear"))
     if clear and topic:
         raise error.Abort(_("cannot use --clear when setting a topic"))
+    if age and topic:
+        raise error.Abort(_("cannot use --age while setting a topic"))
 
     touchedrevs = set()
     if rev:
--- a/tests/test-topic.t	Mon Sep 25 03:29:45 2017 +0530
+++ b/tests/test-topic.t	Mon Sep 25 03:30:56 2017 +0530
@@ -999,4 +999,7 @@
      topic1990 (1990-01-01 by foo)
    * topic1970 (1970-01-01 by test)
 
+  $ hg topics --age random
+  abort: cannot use --age while setting a topic
+  [255]
   $ cd ..