[PATCH 2 of 3 topic-ext] topic: only require obsolete support for --change

Matt Mackall mpm at selenic.com
Fri Jun 12 15:49:53 CDT 2015


# HG changeset patch
# User Matt Mackall <mpm at selenic.com>
# Date 1433976050 18000
#      Wed Jun 10 17:40:50 2015 -0500
# Node ID 7d7758a9bef4a197e04399aeb54115809b42ed13
# Parent  0da6bf86b718a4da38a2d79c6d7bc758c19ce2f6
topic: only require obsolete support for --change

diff -r 0da6bf86b718 -r 7d7758a9bef4 src/topic/__init__.py
--- a/src/topic/__init__.py	Wed Jun 10 17:13:15 2015 -0500
+++ b/src/topic/__init__.py	Wed Jun 10 17:40:50 2015 -0500
@@ -71,10 +71,9 @@
 ])
 def topics(ui, repo, topic=None, clear=False, change=None):
     """View current topic, set current topic, or see all topics."""
-    if not obsolete.isenabled(repo, obsolete.createmarkersopt):
-        raise util.Abort('current reality means you should only '
-                         'use topic with obsolete enabled')
     if change:
+        if not obsolete.isenabled(repo, obsolete.createmarkersopt):
+            raise util.Abort(_('must have obsolete enabled to use --change'))
         if topic is None and not clear:
             raise util.Abort('changing topic requires a topic name or --clear')
         if any(not c.mutable() for c in repo.set('%r and public()', change)):
diff -r 0da6bf86b718 -r 7d7758a9bef4 tests/test-topic.t
--- a/tests/test-topic.t	Wed Jun 10 17:13:15 2015 -0500
+++ b/tests/test-topic.t	Wed Jun 10 17:40:50 2015 -0500
@@ -20,6 +20,15 @@
   (some details hidden, use --verbose to show complete help)
   $ hg topics
 
+Test topics interaction with evolution:
+
+  $ hg topics --config experimental.evolution=
+  $ hg topics --config experimental.evolution= --change . bob
+  abort: must have obsolete enabled to use --change
+  [255]
+
+Create some changes:
+
   $ for x in alpha beta gamma delta ; do
   >   echo file $x >> $x
   >   hg addremove


More information about the Mercurial-devel mailing list