hghooks: don't process strips in prevent_webidl_changes hook (bug 1128698); r=bkero
authorGregory Szorc <gps@mozilla.com>
Fri, 06 Feb 2015 17:21:36 -0800
changeset 1985 791340bd0fb0f94e1a9d9905c8f5e01934901092
parent 1984 b2ab98409a0cb99c7b031e9a061de269997df03e
child 1986 4b9b07df10c068d10d886b8efdeda40c43fa1f49
push id543
push usergszorc@mozilla.com
push dateTue, 10 Feb 2015 20:31:55 +0000
treeherderversion-control-tools@33a0fa9dc70d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkero
bugs1128698
hghooks: don't process strips in prevent_webidl_changes hook (bug 1128698); r=bkero
hghooks/mozhghooks/prevent_webidl_changes.py
hghooks/tests/test-prevent-webidl.t
--- a/hghooks/mozhghooks/prevent_webidl_changes.py
+++ b/hghooks/mozhghooks/prevent_webidl_changes.py
@@ -28,17 +28,20 @@ backoutMessage = [re.compile(x) for x in
 ]]
 
 def isBackout(message):
     for r in backoutMessage:
         if r.search(message):
             return True
     return False
 
-def hook(ui, repo, hooktype, node, **kwargs):
+def hook(ui, repo, hooktype, node, source=None, **kwargs):
+    if source == 'strip':
+        return 0
+
     DOM_peers = [
         'jst',              # Johnny Stenback
         'peterv',           # Peter Van der Beken
         'bz', 'bzbarsky',   # Boris Zbarsky
         'sicking', 'jonas', # Jonas Sicking
         'smaug',            # Olli Pettay
         'bent',             # Ben Turner
         'mounir',           # Mounir Lamouri
--- a/hghooks/tests/test-prevent-webidl.t
+++ b/hghooks/tests/test-prevent-webidl.t
@@ -272,26 +272,12 @@ Hook should not run when stripping
   > [extensions]
   > strip =
   > 
   > [hooks]
   > pretxnchangegroup.prevent_webidl = python:mozhghooks.prevent_webidl_changes.hook
   > EOF
 
   $ hg strip -r 1 --no-backup
-  
-  
-  ************************** ERROR ****************************
-  
-  WebIDL file original.webidl altered in changeset d9d509b9ec59 without DOM peer review
-  
-  
-  Changes to WebIDL files in this repo require review from a DOM peer in the form of r=...
-  This is to ensure that we behave responsibly with exposing new Web APIs. We appreciate your understanding..
-  
-  *************************************************************
-  
-  
-  transaction abort!
-  rollback completed
-  strip failed, partial bundle stored in '$TESTTMP/striptest/.hg/strip-backup/c69945245784-temp.hg'
-  abort: pretxnchangegroup.prevent_webidl hook failed
-  [255]
+
+  $ hg log -T '{rev} {desc}\n'
+  1 Bad commit
+  0 initial