--- a/hgext/states.py Mon Sep 12 19:35:50 2011 +0200
+++ b/hgext/states.py Mon Sep 12 23:47:06 2011 +0200
@@ -247,6 +247,13 @@
- add ``<state>()`` directives that match all node in a state.
+Other extensions
+................
+
+:Rebase: can't rewrite unpublished changeset.
+
+
+
Implementation
==============
@@ -634,6 +641,22 @@
h = repo.stateheads(st)
return wireproto.encodelist(h) + "\n"
+# Other extension support
+#########################
+
+def wraprebasebuildstate(orig, repo, *args, **kwargs):
+ result = orig(repo, *args, **kwargs)
+ if result is not None:
+ revs = result[2]
+ base = repo.changelog.node(min(result[2]))
+ state = repo.nodestate(base)
+ if not state.properties & _MUTABLE:
+ raise util.Abort(_('can not rebase published changeset %s')
+ % node.short(base),
+ hint=_('see `hg help --extension states` for details'))
+ return result
+
+
def uisetup(ui):
"""
* patch stuff for the _NOSHARE property
@@ -656,6 +679,12 @@
for state in STATES:
if state.trackheads:
revset.symbols[state.headssymbol] = state._revsetheads
+ try:
+ rebase = extensions.find('rebase')
+ if rebase:
+ extensions.wrapfunction(rebase, 'buildstate', wraprebasebuildstate)
+ except KeyError:
+ pass # rebase not found