changeset 28053:34a2944aac9b

check-code: add rule to detect usage of external diff via extdiff This rule detects "hg extdiff" invocation without -p/--program and -o/--option. This patch specifies "-p diff" explicitly in test-extdiff.t to avoid false positive matching.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 11 Feb 2016 02:15:45 +0900
parents b59ef0c21405
children 8515b813976b
files contrib/check-code.py tests/test-extdiff.t
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Mon Feb 08 18:29:17 2016 +0900
+++ b/contrib/check-code.py	Thu Feb 11 02:15:45 2016 +0900
@@ -186,6 +186,9 @@
      "use '@@ -N,n +N* @@ (glob)' style chunk header for portability"),
     (r'^  @@ -[0-9]+ [+][0-9]+ @@',
      "use '@@ -N* +N* @@ (glob)' style chunk header for portability"),
+    (uprefix + r'hg( +-[^ ]+( +[^ ]+)?)* +extdiff'
+     r'( +(-[^ po-]+|--(?!program|option)[^ ]+|[^-][^ ]*))*$',
+     "use $RUNTESTDIR/pdiff via extdiff (or -o/-p for false-positives)"),
   ],
   # warnings
   [
--- a/tests/test-extdiff.t	Mon Feb 08 18:29:17 2016 +0900
+++ b/tests/test-extdiff.t	Thu Feb 11 02:15:45 2016 +0900
@@ -72,7 +72,7 @@
 
 Specifying an empty revision should abort.
 
-  $ hg extdiff --patch --rev 'ancestor()' --rev 1
+  $ hg extdiff -p diff --patch --rev 'ancestor()' --rev 1
   abort: empty revision on one side of range
   [255]