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 194 7d2946588c3706c9836e75d8e39da33efc050a95
parent 193 476532bb505e7592f3d0d930d6213340aae7c239
child 195 1d448b7b8187833f91fea05bebed82875dc2e881
push id122
push usereakhgari@mozilla.com
push dateThu, 22 May 2014 19:07:41 +0000
reviewersted
bugs1014397
Bug 1014397 - Allow sr= in addition to r= in the prevent_webidl_changes hook; r=ted
mozhghooks/prevent_webidl_changes.py
runtests.py
--- a/mozhghooks/prevent_webidl_changes.py
+++ b/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/runtests.py
+++ b/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")