1. Alain Leufroy
  2. mutable-history

Commits

Alain Leufroy  committed a5f6194

[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

  • Participants
  • Parent commits 7571534
  • Branches default

Comments (0)

Files changed (2)

File hgext/states.py

View file
  • Ignore whitespace
             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()

File tests/test-states.t

View file
  • Ignore whitespace
   $ hg -R ../other states
   published
 
+do nothing if state already deactivated
+  $ hg states --off draft
+  state draft already deactivated
+  $ hg states
+  published
+  ready