changeset 76:1d922a43886c

Lax bugids
author mr
date Tue, 11 Sep 2012 09:50:00 -0700
parents c7407e995446
children 82ca5551fea4
files jcheck.py mktests.sh runtests.sh
diffstat 3 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jcheck.py	Wed Aug 08 13:50:08 2012 +0200
+++ b/jcheck.py	Tue Sep 11 09:50:00 2012 -0700
@@ -318,6 +318,9 @@
         if self.conf.get("tags") == "lax":
             self.tags_lax = True
         self.bugids_allow_dups = self.conf.get("bugids") == "dup"
+        self.bugids_lax = lax and not strict
+        if self.conf.get("bugids") == "lax":
+            self.bugids_lax = True
         self.blacklist = dict.fromkeys(changeset_blacklist)
         self.read_blacklist(blacklist_file)
         # hg < 1.0 does not have localrepo.tagtype()
@@ -399,7 +402,8 @@
             while (st.ident_pattern.match(ln)):
                 m = st.check_pattern.match(ln)
                 if not m:
-                    self.error(ctx, "Invalid %s" % st.name)
+                    if not (st.name == "bugid line" and self.bugids_lax):
+                        self.error(ctx, "Invalid %s" % st.name)
                 elif st.validator:
                     st.validator(self, ctx, m, self.conf["project"])
                 n = n + 1
--- a/mktests.sh	Wed Aug 08 13:50:08 2012 +0200
+++ b/mktests.sh	Tue Sep 11 09:50:00 2012 -0700
@@ -308,3 +308,5 @@
 
 fail_lax ci -m "Foo bar baz
 Reviewed-by: $fail_author_lax"
+
+pass_lax ci -m "123: Silly bugid"
--- a/runtests.sh	Wed Aug 08 13:50:08 2012 +0200
+++ b/runtests.sh	Tue Sep 11 09:50:00 2012 -0700
@@ -205,6 +205,21 @@
 if HGUSER=$setup_author hg ci -R z -m '1111111: Foo!'; then true; else fail; fi
 r=$(expr $r + 1)
 
+# Lax bugids
+echo "-- $r lax bug ids"
+rm -rf z
+hg init z
+mkdir z/.jcheck
+cat >z/.jcheck/conf <<___
+project=jdk7
+comments=lax
+bugids=lax
+___
+hg add -R z z/.jcheck/conf
+
+if HGUSER=$setup_author hg ci -R z -m '1234: Silly bugid'; then true; else fail; fi
+r=$(expr $r + 1)
+
 # tags=lax tests
 echo "-- $r tags=lax tag check"
 rm -rf z