changeset 1842:94bbc18daa99

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.
author Augie Fackler <augie@google.com>
date Wed, 10 Jun 2015 15:01:36 -0400
parents 72a58a5bfb62
children 0ba067a97d06
files src/topic/__init__.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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')