Smarter states heads.
We use the next relevant heads instead of repo one when asking for the head of a
disabled state.
--- a/states.py Mon Jun 06 15:30:43 2011 +0200
+++ b/states.py Mon Jun 06 16:52:03 2011 +0200
@@ -78,6 +78,10 @@
else:
return 'heads'
+ def enabled(self, ui):
+ return ui.configbool('states', self.name, False)
+
+
ST2 = state('draft', _NOSHARE | _MUTABLE)
ST1 = state('ready', _MUTABLE, next=ST2)
ST0 = state('published', next=ST1)
@@ -188,9 +192,12 @@
def stateheads(self, state):
+ # look for a relevant state
+ while state.trackheads and not state.next.enabled(self.ui):
+ state = state.next
+ # last state have no cached head.
if state.trackheads:
- if self.ui.configbool('states', state.next.name, False):
- return self._statesheads[state]
+ return self._statesheads[state]
return self.heads()
@util.propertycache