# HG changeset patch
# User David Soria Parra <davi...@fb.com>
# Date 1482293000 28800
#      Tue Dec 20 20:03:20 2016 -0800
# Node ID ff1014e78d5a3084eda379ec51b1c0a1fc4f5b2a
# Parent  11deeb8980886f1bd45c56e8ac3ab662b4fdb252
check-commit: add magic string to bypass check-commit

Allow bypassing check-commit runs by specifying '# no-check-commit' at the
beginning of a line. This should be avoided but is useful for upstream imports
such as pywatchman which will cause check-code to fail otherwise.

diff --git a/contrib/check-commit b/contrib/check-commit
--- a/contrib/check-commit
+++ b/contrib/check-commit
@@ -25,6 +25,7 @@
 afterheader = commitheader + r"(?!#)"
 beforepatch = afterheader + r"(?!\n(?!@@))"
 
+bypass = r"^# no-check-commit"
 errors = [
     (beforepatch + r".*[(]bc[)]", "(BC) needs to be uppercase"),
     (beforepatch + r".*[(]issue \d\d\d",
@@ -59,6 +60,9 @@
     exitcode = 0
     printed = node is None
     hits = []
+    if re.search(bypass, commit, re.MULTILINE):
+        return 0
+
     for exp, msg in errors:
         for m in re.finditer(exp, commit):
             end = m.end()
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to