changeset 78:ddcc4bb6c4d4

[states] add some documentation for extension wrapping
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 14 Sep 2011 17:55:17 +0200
parents 45afdbf062f4
children 9906560f585e
files hgext/states.py
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/states.py	Wed Sep 14 17:51:25 2011 +0200
+++ b/hgext/states.py	Wed Sep 14 17:55:17 2011 +0200
@@ -664,8 +664,11 @@
 #########################
 
 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]
@@ -675,10 +678,12 @@
             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'])
@@ -690,7 +695,7 @@
                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):