diff hgext/states.py @ 90:a5f6194eb05c

[states] do not activate deactivated state with ``hg states --off <state>`` previously: $ hg init alpha $ cd alpha $ hg states --off draft $ hg states published draft now: $ hg init alpha $ cd alpha $ hg states --off draft $ hg states published
author Alain Leufroy <alain.leufroy@logilab.fr>
date Tue, 13 Sep 2011 15:35:49 +0200
parents 97a5c943db19
children d5170cc7881c
line wrap: on
line diff
--- a/hgext/states.py	Mon Sep 19 18:27:30 2011 +0200
+++ b/hgext/states.py	Tue Sep 13 15:35:49 2011 +0200
@@ -517,8 +517,13 @@
             else:
                 ui.write_err(_('no state named %s\n') % state_name)
                 return 1
-            if off and st in repo._enabledstates:
-                repo._enabledstates.remove(st)
+            if off:
+                if st in repo._enabledstates:
+                    repo._enabledstates.remove(st)
+                else:
+                    ui.write_err(_('state %s already deactivated\n') %
+                                 state_name)
+
             else:
                 repo._enabledstates.add(st)
         repo._writeenabledstates()