topic: disallow use of topics without obsolete enabled
authorAugie Fackler <augie@google.com>
Wed, 10 Jun 2015 15:01:36 -0400
changeset 1842 94bbc18daa99
parent 1841 72a58a5bfb62
child 1843 0ba067a97d06
topic: disallow use of topics without obsolete enabled This is a prelude to allowing changing topics. The experience will be disastrous without obsolete markers, so let's just preempt any potential problems.
src/topic/__init__.py
--- a/src/topic/__init__.py	Wed Jun 10 14:59:46 2015 -0400
+++ b/src/topic/__init__.py	Wed Jun 10 15:01:36 2015 -0400
@@ -14,6 +14,7 @@
 from mercurial import commands
 from mercurial import extensions
 from mercurial import namespaces
+from mercurial import obsolete
 from mercurial import phases
 from mercurial import util
 
@@ -62,6 +63,9 @@
 ])
 def topics(ui, repo, topic=None, clear=False):
     """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 clear:
         if repo.vfs.exists('topic'):
             repo.vfs.unlink('topic')