]> granicus.if.org Git - openjpeg/commitdiff
CtrlM check added when committing files
authorAntonin Descampe <antonin@gmail.com>
Sun, 22 Jan 2006 19:19:19 +0000 (19:19 +0000)
committerAntonin Descampe <antonin@gmail.com>
Sun, 22 Jan 2006 19:19:19 +0000 (19:19 +0000)
CVSROOT/checkCtrlM [new file with mode: 0755]
CVSROOT/checkTabs [new file with mode: 0755]
CVSROOT/checkoutlist
CVSROOT/checktabs.sh [deleted file]
CVSROOT/commitinfo

diff --git a/CVSROOT/checkCtrlM b/CVSROOT/checkCtrlM
new file mode 100755 (executable)
index 0000000..3d7cbb4
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# checkCtrlM checks source code for explicit ctrl-M's
+#   checks only files with the following extensions: .c, .cxx, .txx, .html, .htm
+#   exits with 0, if all commited files pass the test.
+#   exits with 1, if any one of the tests fails
+#
+# checkCtrlM can be run as a cvs commitinfo command.
+# The following commitinfo line (without the #) will run the script
+# ALL  $CVSROOT/CVSROOT/checkCtrlM
+# 
+failed=0
+#
+# skip the first arg, the directory
+shift 1
+
+for file in "$@"; do
+  #
+  # select files with extentions .txx, .cxx, .h, .html, .htm
+  match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]html\$\|\[\.\]htm\$\|\[\.\]c\$`
+  if [ "x$match" != "x" ] ; then
+    count=`grep -n 
+\$ /dev/null $file|wc -c`
+    results=`expr $count \| 0`
+    if [ "$results" != "0" ]; then
+      echo "=========================================================="
+      if [ $results -lt 200 ]; then
+        grep -n 
+\$ /dev/null $file
+      fi
+      echo ""
+      echo "$file has ^M's. They must be removed before you can commit."
+      echo "The problem count was $results"
+      echo "=========================================================="
+      failed=1
+    fi
+  fi
+done
+exit $failed
diff --git a/CVSROOT/checkTabs b/CVSROOT/checkTabs
new file mode 100755 (executable)
index 0000000..8a8e900
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/tcsh
+#
+# checkTabs checks source code for explicit TABS
+#   checks only files with the following extensions: .c, .cxx, .txx,
+#   exits with 0, if all commited files pass the test.
+#   exits with 1, if any one of the tests fails
+#
+# checkTabs can be run as a cvs commitinfo command.
+# The following commitinfo line (without the #) will run the script
+# ALL  $CVSROOT/CVSROOT/checkTabs
+# 
+set failed=0
+#
+# skip the first arg, the directory
+foreach file ( $argv[2-] )
+#
+# select files with extentions .txx, .cxx, .h, .html, .htm
+set match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]cpp\$\|\[\.\]htm\$\|\[\.\]html\$\|\[\.\]c\$\|\[\.\]mm\$\|\[\.\]h.in\$\|\[\.\]hxx.in\$\|CMakeLists.txt\$\|\[\.\]cmake\$\|\[\.\]cmake.in\$`
+if ( $match == "" ) continue;
+set count=`grep -n "   " /dev/null $file|wc -c`
+set results=`expr $count \| 0`
+if ( "$results" != "0" ) then
+       echo "=========================================================="
+       grep -n "       " /dev/null $file
+       echo ""
+       echo "$file has explicit TABSs."
+       echo "They must be converted to SPACES(2 per TAB) before you can commit."
+       echo "=========================================================="
+       set failed=1
+endif
+end
+exit $failed
index b04b3501f5efd94313942eb7439457bc82f5a2f5..80efd79e8c389f29d81731887b811afc46689d44 100644 (file)
@@ -11,3 +11,5 @@
 #      [<whitespace>]<filename><whitespace><error message><end-of-line>
 #
 # comment lines begin with '#'
+checkCtrlM cannot check out checkCtrlM
+checkTabs cannot check out checkTabs
diff --git a/CVSROOT/checktabs.sh b/CVSROOT/checktabs.sh
deleted file mode 100755 (executable)
index 19a522e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/tcsh
-#
-# checkTabs checks source code for explicit TABS
-# checks only files with the following extensions: .c, .cxx, .txx,
-# exits with 0, if all commited files pass the test.
-# exits with 1, if any one of the tests fails
-#
-# checkTabs can be run as a cvs commitinfo command.
-# The following commitinfo line (without the #) will run the script
-# ALL $CVSROOT/CVSROOT/checkTabs
-#
-set failed=0
-#
-# skip the first arg, the directory
-foreach file ( $argv[2-] )
-#
-# select files with extentions .txx, .cxx, .h, .html, .htm
-set match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]c\$`
-if ( $match == "" ) continue;
-set count=`grep -n "   " /dev/null $file|wc -c`
-set results=`expr $count \| 0`
-if ( "$results" != "0" ) then
-        echo
-"=========================================================="
-        grep -n "      " /dev/null $file
-        echo ""
-        echo "$file has explicit TABSs."
-        echo "They must be converted to SPACES(2 per TAB) before you can commit."
-        echo
-"=========================================================="
-        set failed=1
-endif
-end
-exit $failed
\ No newline at end of file
index daefd4ed537d46653fc6c2b6d72b38ccaa6dfa8a..b30b288c136023afd36cf414c52b7cd2e447f765 100644 (file)
@@ -14,4 +14,5 @@
 # If the name "ALL" appears as a regular expression it is always used
 # in addition to the first matching regex or "DEFAULT".
 
-# ALL $CVSROOT/CVSROOT/checktabs.sh
+ALL    $CVSROOT/CVSROOT/checkCtrlM %r/%p %s
+# ALL  $CVSROOT/CVSROOT/checkTabs %r/%p %s