changeset 122:29fe63a48963

Disallow 'Reviewed-by: duke'
author mr
date Wed, 07 Mar 2018 08:54:50 -0800
parents 371cbd43b399
children 6524b0b2250b
files jcheck.py mktests.sh runtests.sh
diffstat 3 files changed, 68 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/jcheck.py	Thu Mar 01 15:27:30 2018 -0800
+++ b/jcheck.py	Wed Mar 07 08:54:50 2018 -0800
@@ -204,7 +204,7 @@
 def rev_validate(ch, ctx, m, pn):
     ans = re.split(", *", m.group(1))
     for an in ans:
-        if not validate_author(an, pn):
+        if not validate_author(an, pn) or an == "duke":
             ch.error(ctx, "Invalid reviewer name: %s" % an)
         ch.cs_reviewers.append(an)
 
@@ -385,6 +385,19 @@
     '840eac30564f5304dbaaec276a2dabf353c7f623',
     'fd67174f8a7708238c84896603a960ea9b5e3cca',
 
+    # Reviewed-by: duke
+    '2ae445f57ac60fee1dcf4d518f605a71680261f9',
+    '4814eec6a323bbe72113878a8adf86ce1206abb8',
+    '17e70318af8bdcd89bc2d75829bc376061a9e24d',
+    '413576d00672c3725dd7517703b96804d4fdea97',
+    'd2a313368ccbaa1a3ce8276ead68461d08a7593e',
+    'e70067b81b0b05cda3f84be73426ff97a681641b',
+    '387a39577f09c87a06b502ccca9e608ea73ed4e4',
+    '96179f26139e78f90b1cd6c528013d4c496f89be',
+    '3683a58d8a6836175aa946afc026930b79a57204',
+    '2d9dad1b821abffb3fd9e12a2d585f77bc0d5ff9',
+    'e321560ac819c05274c59f46f5cc28ccfd4b38ec',
+
     ]
 
 # Bad changesets that should never be allowed in
--- a/mktests.sh	Thu Mar 01 15:27:30 2018 -0800
+++ b/mktests.sh	Wed Mar 07 08:54:50 2018 -0800
@@ -30,7 +30,7 @@
 
 date >date
 HGUSER=$setup_author hg ci -Am '1000000: Init
-Reviewed-by: duke'
+Reviewed-by: alanb'
 
 echo 1000001 >.hg/bugid
 
@@ -47,7 +47,7 @@
   export HGUSER=$1; shift
   if [ -z "$*" ]; then
     msg="$(bugid): Bug
-Reviewed-by: duke"
+Reviewed-by: alanb"
     (set -x; hg ci -m "$msg")
   else
     (set -x; hg "$@")
@@ -65,20 +65,20 @@
 # THESE MUST BE FIRST since they refer to specific revision indices
 
 setup ci -m "$(bugid): Bug to merge
-Reviewed-by: duke"
+Reviewed-by: alanb"
 hg bundle --base 0 -r 1 z
 hg rollback
 (datefile=date2 setup ci -m "$(bugid): Merge to bug
-Reviewed-by: duke")
+Reviewed-by: alanb")
 (export HGUSER=$fail_author; set -x; hg fetch z)
 rm z
 
 setup ci -m "$(bugid): Bug to merge
-Reviewed-by: duke"
+Reviewed-by: alanb"
 hg bundle --base 3 -r 4 z
 hg rollback
 (datefile=date3 setup ci -m "$(bugid): Merge to bug
-Reviewed-by: duke")
+Reviewed-by: alanb")
 (export HGUSER=$pass_author; set -x; hg fetch -m Merge z)
 rm z
 
@@ -118,28 +118,28 @@
 fail ci -m "Blah blah"
 
 pass ci -m "$(bugid): A random bug
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid): A random bug
- Reviewed-by: duke"
+ Reviewed-by: alanb"
 
 fail ci -m " $(bugid): A random bug
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid):  A random bug
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid):
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid): A random bug
-Reviewed-by:  duke"
+Reviewed-by:  alanb"
 
-fail ci -m "Reviewed-by: duke"
+fail ci -m "Reviewed-by: alanb"
 
 fail ci -m "$(bugid): A random bug
 Blah blah
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid): A random bug"
 
@@ -160,27 +160,27 @@
 
 pass ci -m "$(bugid): A random bug
 $(bugid): Another random bug
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "123456: A short bugid
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "nobugid: No bugid
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "0000000: Bad bugid
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 for i in 1 2 4 5 6 7 8
 do
     pass ci -m "${i}112222: bugid ${i}xxxxxx
-Reviewed-by: duke"
+Reviewed-by: alanb"
 done
 
 for i in 3 9
 do
     fail ci -m "${i}112222: bugid ${i}xxxxxx
-Reviewed-by: duke"
+Reviewed-by: alanb"
 done
 
 pass ci -m "$(bugid): The next bug
@@ -193,39 +193,39 @@
 Contributed-by: Ben Bitdiddle <ben@bits.org>"
 
 pass ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by: ben@bits.org"
 
 pass ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by: Ben Bitdiddle <ben@bits.org>"
 
 pass ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by: Ben Bitdiddle <ben@bits.org>, Alyssa P Hacker <alyssa@hacker.net>"
 
 pass ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by: ben@bits.org, Alyssa P Hacker <alyssa@hacker.net>"
 
 pass ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by: ben@bits.org, alyssa@hacker.net"
 
 fail ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by: ben@bits.org alyssa@hacker.net"
 
 fail ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by:  Ben Bitdiddle <ben@bits.org>"
 
 fail ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by: Ben Bitdiddle"
 
 fail ci -m "$(bugid): Another bug
-Reviewed-by: duke
+Reviewed-by: alanb
 Contributed-by: foo"
 
 fail ci -m "$(bugid): Another bug
@@ -234,46 +234,46 @@
 
 pass ci -m "$(bugid): Yet another bug
 Summary: Rewrite code
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid): Yet another bug
 Summary: 
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid): Yet another bug
 Summary:  Rewrite code
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid): Yet another bug
  Summary: Rewrite code
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid): Yet another bug
 Summary: Rewrite code
 
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "1000002: Duplicate bugid
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 b=$(bugid)
 fail ci -m "$b: Duplicate bugid in changeset
 $b: Duplicate bugid in changeset
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 # hg seems to strip trailing whitespace,
 # at least for comments given with -m
 pass ci -m "$(bugid): That's some bug 
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 pass ci -m "$(bugid): That's some bug
-Reviewed-by: duke "
+Reviewed-by: alanb "
 
 pass ci -m "$(bugid): That's some bug
-Reviewed-by: duke
"
+Reviewed-by: alanb
"
 
 fail ci -m "$(bugid): That's some	bug
-Reviewed-by: duke"
+Reviewed-by: alanb"
 
 fail ci -m "$(bugid): Buggy bug bug bug
 Reviewed-by: fang"
@@ -291,6 +291,9 @@
 Reviewed-by: $pass_author
 Contributed-by: ben@bits.org"
 
+fail ci -m "$(bugid): Reviewed by duke
+Reviewed-by: duke"
+
 
 # Lax changeset comments
 
--- a/runtests.sh	Thu Mar 01 15:27:30 2018 -0800
+++ b/runtests.sh	Wed Mar 07 08:54:50 2018 -0800
@@ -78,7 +78,7 @@
 date >>date.$n
 hg add date.$n
 HGUSER=$setup_author hg ci -m "$(bugid): Head one
-Reviewed-by: duke"
+Reviewed-by: alanb"
 rm -rf z
 hg bundle --base $n -r $(expr $n + 1) z
 hg rollback
@@ -86,7 +86,7 @@
 date >>date.$n.2
 hg add date.$n.2
 HGUSER=$setup_author hg ci -m "$(bugid): Head two
-Reviewed-by: duke"
+Reviewed-by: alanb"
 HG='hg --config hooks.pretxnchangegroup.jcheck=python:jcheck.strict_hook'
 if HGUSER=$setup_author $HG pull z; then fail $r; fi
 hg revert date.$n.2
@@ -101,7 +101,7 @@
 hg add date.$r
 HG='hg --config hooks.pretxncommit.jcheck=python:jcheck.hook'
 if HGUSER=$setup_author $HG ci -m "$(bugid): Branch
-Reviewed-by: duke" ; then fail $r; fi
+Reviewed-by: alanb" ; then fail $r; fi
 hg rollback; hg revert -a
 rm .hg/branch ## hg bug ?
 r=$(expr $r + 1)
@@ -154,8 +154,8 @@
 
 # Black/white lists
 
-blackhash=b5dd894e33c0dfa6cde0c5c5fd1f7a7e5edd6f01
-whitehash=1c3c89ae5adcd57d074a268c5328df476ccabf52
+blackhash=e8fdeed7604523b5460df91973d6133b1120b8f7
+whitehash=5a8ece55687803eb726738773a8b5ecc56998ee0
 rm -rf z
 hg init z
 mkdir z/.jcheck
@@ -170,8 +170,9 @@
 echo foo >z/foo
 hg add -R z z/foo
 HGUSER=$setup_author hg ci -R z -m '1010101: Good but black
-Reviewed-by: duke' -d '0 0'
-if hg jcheck_test --black $blackhash -R z -r tip; then fail; fi
+Reviewed-by: alanb' -d '0 0'
+if hg jcheck_test --black $blackhash -R z -r tip; then
+  hg log -R z -r tip --template '{node}\n'; fail; fi
 r=$(expr $r + 1)
 
 echo "-- $r blacklist file 1"
@@ -195,7 +196,8 @@
 echo "-- $r whitelist"
 echo foobar >z/foo
 HGUSER=$setup_author hg ci -R z -m '1010101: Bad but white' -d '0 0'
-if hg jcheck_test --white $whitehash -R z -r tip; then true; else fail; fi
+if hg jcheck_test --white $whitehash -R z -r tip; then true; else 
+  hg log -R z -r tip --template '{node}\n'; fail; fi
 r=$(expr $r + 1)
 
 # Duplicate bugids
@@ -330,7 +332,7 @@
 pretxncommit.jcheck=python:jcheck.hook
 ___
 if HGUSER=$setup_author hg ci -R z -m '1111111: Foo!
-Reviewed-by: duke' -d '0 0' \
+Reviewed-by: alanb' -d '0 0' \
    && HGUSER=$setup_author $HG tag -R z -r tip hsparent
 then true; else fail; fi
 r=$(expr $r + 1)