--- a/hgext/states.py Thu Sep 22 19:18:40 2011 +0200
+++ b/hgext/states.py Sun Sep 25 12:46:45 2011 +0200
@@ -151,8 +151,6 @@
:on: state enabled for new repo
:inherit: if present, inherit states of source on :hg:`clone`.
-- have a switch to select if changesets do change state on state activation.
-
- display the number of changesets that change state when activating a state.
@@ -523,11 +521,14 @@
state_name)
else:
- repo._enabledstates.add(st)
+ repo.enablestate(st, not opt.get('clever'))
repo._writeenabledstates()
return 0
-cmdtable = {'states': (cmdstates, [ ('', 'off', False, _('desactivate the state') )], '<state>')}
+cmdtable = {'states': (cmdstates, [
+ ('', 'off', False, _('desactivate the state') ),
+ ('', 'clever', False, _('do not fix lower when activating the state') )],
+ '<state>')}
# automatic generation of command that set state
def makecmd(state):
@@ -786,6 +787,13 @@
break
return state
+ def enablestate(self, state, fix_lower=True):
+ if fix_lower:
+ # at least published which is always activated
+ lower = max(st for st in self._enabledstates if st < state)
+ self.setstate(lower, self.stateheads(state))
+ self._enabledstates.add(state)
+
def disablestate(self, state):
"""Disable empty state.
Raise error.Abort if the state is not empty.