RFR (XS): jcheck: Enforce lower-case author names

mark.reinhold at oracle.com mark.reinhold at oracle.com
Mon Jun 24 14:06:10 PDT 2013


It turns out that jcheck never enforced lower-case author names, and the
db.ojn server incorrectly accepts mixed-case names.  I'll fix that on
the server, but it makes sense to enforce it locally as well in jcheck.

I ran this revised jcheck over the current JDK 8 and JDK 7 Updates
forests, found two changesets with capital letters in the author name,
and added the hashes of those changesets to the whitelist in the patch
below.

Thanks,
- Mark


diff --git a/jcheck.py b/jcheck.py
--- a/jcheck.py
+++ b/jcheck.py
@@ -100,8 +100,11 @@
 # Author validation
 
 author_cache = { }                      ## Should really cache more permanently
+author_re = re.compile("[a-z]+")
 
 def validate_author(an, pn):
+  if not author_re.match(an):
+    return False
   if author_cache.has_key(an):
     return True
   u = ("http://db.openjdk.java.net/people/%s/projects/%s"
@@ -252,7 +255,9 @@
     'd77434402021cebc4c25b452db18bbfd2d7ccda1', # jdk6/jdk6/jdk  bad comment
     '931e5f39e365a0d550d79148ff87a7f9e864d2e1', # hotspot dup bug id 7147064
     'd8abc90163a4b58db407a60cba331ab21c9977e7', # hotspot dup bug id 7147064
-    '45849c62c298aa8426c9e67599e4e35793d8db13'  # pubs executable files
+    '45849c62c298aa8426c9e67599e4e35793d8db13', # pubs executable files
+    '9b5c596a2920af10bde905d5fdece110204ebdaa', # all-caps author name
+    '1785f8335f4dd2a6a2c47e348bb588c9e7fcd374'  # all-caps author name
     ]
 
 # Bad changesets that should never be allowed in
diff --git a/runtests.sh b/runtests.sh
--- a/runtests.sh
+++ b/runtests.sh
@@ -332,6 +332,13 @@
 if [ $? -eq 0 ]; then fail; fi
 r=$(expr $r + 1)
 
+echo "-- $r lower-case author names"
+touch z/foo2
+hg add -R z z/foo2
+if $HG ci -R z -u Robilad -m '1111112: Foo!
+Reviewed-by: duke' -d '0 0'; then fail; fi
+r=$(expr $r + 1)
+
 # Summary
 
 if [ $failures -gt 0 ]; then


More information about the hg-tools-dev mailing list