Commits

Pierre-Yves David committed ddcc4bb

[states] add some documentation for extension wrapping

Comments (0)

Files changed (1)

 #########################
 
 def wraprebasebuildstate(orig, repo, *args, **kwargs):
-   result = orig(repo, *args, **kwargs)
-   if result is not None:
+    """Wrapped rebuild state that check for immutable changeset
+
+    buildstate are the best place i found to hook :-/"""
+    result = orig(repo, *args, **kwargs)
+    if result is not None:
         # rebase.nullmerge is issued in the detach case
         rebase = extensions.find('rebase')
         rebased = [rev for rev, rbst in result[2].items() if rbst != rebase.nullmerge]
             raise util.Abort(_('can not rebase published changeset %s')
                              % node.short(base),
                              hint=_('see `hg help --extension states` for details'))
-   return result
+    return result
 
 def wrapmqqimport(orig, queue, repo, *args, **kwargs):
-   if 'rev' in kwargs:
+    """Wrapper for rebuild state that deny importing immutable changeset
+    """
+    if 'rev' in kwargs:
        # we can take the min as non linear import will break
        # anyway
        revs = scmutil.revrange(repo, kwargs['rev'])
                raise util.Abort(_('can not qimport published changeset %s')
                     % node.short(basenode),
                     hint=_('see `hg help --extension states` for details'))
-   return orig(queue, repo, *args, **kwargs)
+    return orig(queue, repo, *args, **kwargs)
 
 
 def uisetup(ui):