hghooks: don't process strips in prevent_uuid_changes hook (bug 1128698); r=bkero
authorGregory Szorc <gps@mozilla.com>
Wed, 04 Feb 2015 17:14:51 -0800
changeset 1983 5b5df02b6e0c73302759018d69d67ec122f149f4
parent 1982 c0e045f412173f4595b0fd9bdbc6d62a054b61e8
child 1984 b2ab98409a0cb99c7b031e9a061de269997df03e
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_uuid_changes hook (bug 1128698); r=bkero
hghooks/mozhghooks/prevent_uuid_changes.py
hghooks/tests/test-prevent-uuid-changes.t
--- a/hghooks/mozhghooks/prevent_uuid_changes.py
+++ b/hghooks/mozhghooks/prevent_uuid_changes.py
@@ -15,17 +15,20 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """
 This hook is to prevent changes to IID or UUID in pushes to trees where such changes could cause critical issues (eg: beta, release).
 """
 
 import re
 
-def hook(ui, repo, hooktype, node, **kwargs):
+def hook(ui, repo, hooktype, node, source=None, **kwargs):
+    if source == 'strip':
+        return 0
+
     error = ""
     bc = False
     # Loop through each changeset being added to the repository
     for change_id in xrange(repo[node].rev(), len(repo)):
         # Loop through each file for the current changeset
         for file in repo[change_id].files():
             # Only Check IDL Files
             if file.endswith('.idl'):
--- a/hghooks/tests/test-prevent-uuid-changes.t
+++ b/hghooks/tests/test-prevent-uuid-changes.t
@@ -222,25 +222,11 @@ Stripping should not trigger hook
   > [extensions]
   > strip =
   > 
   > [hooks]
   > pretxnchangegroup.prevent_uuid_changes = python:mozhghooks.prevent_uuid_changes.hook
   > EOF
 
   $ hg strip -r 1 --no-backup
-  
-  
-  ************************** ERROR ****************************
-  
-  *** IDL file original.idl altered in this changeset***
-  
-  Changes to IDL files in this repo require you to provide binary change approval in your top comment in the form of ba=... (or, more accurately, ba\S*=...)
-  This is to ensure that UUID changes (or method changes missing corresponding UUID change) are caught early, before release.
-  
-  *************************************************************
-  
-  
-  transaction abort!
-  rollback completed
-  strip failed, partial bundle stored in '$TESTTMP/striptest/.hg/strip-backup/2c33dbd63e71-temp.hg'
-  abort: pretxnchangegroup.prevent_uuid_changes hook failed
-  [255]
+  $ hg log -T '{rev} {desc}\n'
+  1 Bad UUID
+  0 initial