Bug 1014397 - Allow sr= in addition to r= in the prevent_webidl_changes hook; r=ted
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 22 May 2014 09:20:34 -0400
changeset 359282 1a73fc4c47f042ef7e10eb48f3d7a46a69f510dd
parent 359281 665aa1c00ea75abbc72aa3ec5c2bcb28b1b54366
child 359283 510714d475ea1aeabca34cc5217891b0e379c1ec
push id16998
push userrwood@mozilla.com
push dateMon, 02 May 2016 19:42:03 +0000
reviewersted
bugs1014397
Bug 1014397 - Allow sr= in addition to r= in the prevent_webidl_changes hook; r=ted
hghooks/mozhghooks/prevent_webidl_changes.py
hghooks/runtests.py
--- a/hghooks/mozhghooks/prevent_webidl_changes.py
+++ b/hghooks/mozhghooks/prevent_webidl_changes.py
@@ -59,17 +59,17 @@ def hook(ui, repo, hooktype, node, **kwa
             continue
 
         # Loop through each file for the current changeset
         for file in c.files():
             # Only Check WebIDL Files
             if file.endswith('.webidl'):
                 message = c.description().lower()
                 def search():
-                  matches = re.findall('\Wr\s*=\s*(\w+(?:,\w+)*)', message)
+                  matches = re.findall('\Ws?r\s*=\s*(\w+(?:,\w+)*)', message)
                   for match in matches:
                       for reviewer in match.split(','):
                           if reviewer in DOM_peers:
                               return True
                   return False
                 webidlReviewed = search()
                 if not webidlReviewed and not isBackout(message):
                         error += "WebIDL file %s altered in changeset %s without DOM peer review\n" % (file, short(c.node()))
--- a/hghooks/runtests.py
+++ b/hghooks/runtests.py
@@ -917,16 +917,27 @@ class TestPreventWebIDLHook(unittest.Tes
     self.assertEqual(result, 0)
     editFile(join(self.clonedir, "original.webidl"), "interface Bar{};", "interface Baz{};")
     commit(u, self.clonerepo, message="checkin 1 bug 67890; r=foobar r=jst")
     result = push(u, self.clonerepo, dest=self.repodir)
     self.assertEqual(result, 0)
     editFile(join(self.clonedir, "original.webidl"), "interface Baz{};", "interface Bizarre{};")
     commit(u, self.clonerepo, message="checkin 1 bug 123456; r=foobar r=lumpy,jst")
     result = push(u, self.clonerepo, dest=self.repodir)
+    editFile(join(self.clonedir, "original.webidl"), "interface Bizarre{};", "interface Bar{};")
+    commit(u, self.clonerepo, message="checkin 1 bug 123450; sr=foobar,jst")
+    result = push(u, self.clonerepo, dest=self.repodir)
+    self.assertEqual(result, 0)
+    editFile(join(self.clonedir, "original.webidl"), "interface Bar{};", "interface Baz{};")
+    commit(u, self.clonerepo, message="checkin 1 bug 678900; sr=foobar sr=jst")
+    result = push(u, self.clonerepo, dest=self.repodir)
+    self.assertEqual(result, 0)
+    editFile(join(self.clonedir, "original.webidl"), "interface Baz{};", "interface Bizarre{};")
+    commit(u, self.clonerepo, message="checkin 1 bug 1234560; sr=foobar sr=lumpy,jst")
+    result = push(u, self.clonerepo, dest=self.repodir)
     self.assertEqual(result, 0)
 
   def testWebIDLEditWithProperReviewDuringMergeShouldPass(self):
     """ Test that editing .webidl file with proper DOM peer review should pass """
     u = self.ui
     parentrev = short(self.clonerepo.changectx('tip').node())
     editFile(join(self.clonedir, "original.webidl"), "interface Foo{};", "interface Bar{};")
     commit(u, self.clonerepo, message="checkin 1 bug 12345; r=foobar,jst")