Bug 938340 - Don't run critic hook on merges by default
authorGregory Szorc <gps@mozilla.com>
Wed, 13 Nov 2013 14:05:43 -0800
changeset 80 6cb7888ae4b0
parent 79 1048b565cd9d
child 81 6c1765567a66
push id58
push usergszorc@mozilla.com
push dateWed, 13 Nov 2013 22:06:32 +0000
bugs938340
Bug 938340 - Don't run critic hook on merges by default
__init__.py
--- a/__init__.py
+++ b/__init__.py
@@ -247,16 +247,20 @@ mozext.headless
 mozext.ircnick
    Your Mozilla IRC nickname. This string value will be used to look for
    your reviews and patches.
 
 mozext.noautocritic
    When this boolean flag is true, the code critic hook will not run
    during commit and qrefresh operations.
 
+mozext.critic_merges
+   When this boolean flag is true, the code critic hook will run on merges.
+   By default, the hook does not run on merges.
+
 mozext.reject_pushes_with_repo_names
    This boolean is used to enable a ``prepushkey`` hook that prevents
    pushes to keys (bookmarks, tags, etc) whose name is prefixed with that
    of an official Mozilla repository.
 
    This hook is useful for servers exposing a monolithic repository where
    each separate Mozilla repository is exposed through bookmarks and where
    the server does not want to allow external users from changing the
@@ -667,16 +671,20 @@ def buginfo(ui, repo, *bugs, **opts):
     contexts = sorted([repo[node] for node in nodes], key=methodcaller('rev'))
 
     for ctx in contexts:
         print_changeset_pushes(ui, repo, ctx.rev(), all=opts['all'])
         ui.write('\n')
 
 
 def critic_hook(ui, repo, node=None, **opts):
+    # By default, don't run hook on merges.
+    if len(ctx.parents()) > 1 and not ui.configbool('mozext', 'critic_merges'):
+        return 0
+
     critique(ui, repo, node=node, **opts)
     return 0
 
 
 def reject_repo_names_hook(ui, repo, namespace=None, key=None, old=None,
         new=None, **kwargs):
     """prepushkey hook that prevents changes to reserved names.