bug-vc-dwim
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-vc-dwim] vc-chlog: new command line option --no-functions.


From: Ralf Wildenhues
Subject: [Bug-vc-dwim] vc-chlog: new command line option --no-functions.
Date: Mon, 7 Sep 2009 22:20:33 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

Hi Jim,

did you do the release work yet?  If not, can we squeeze this one in?

It's a nice optimization if you don't care about function names in the
commit (e.g., because you're doing a global change that doesn't need
them).  If you have a better suggestion for the option name, I'm all
ears.

Thanks!
Ralf

    vc-chlog: new command line option --no-functions.

    * vc-chlog.in (find_functions): New variable, true by default and
    false if --no-functions was passed.
    (func_help): Document it.
    (func_extract_identifiers): Do not extract identifiers if false.
    * tests/t-vc-chlog: Test it.
    (run_vc_chlog): Accept additional options for vc-chlog.
    * doc/vc-dwim.texi (vc-chlog Invocation, vc-chlog Internals):
    Document it.
    * NEWS: Update.

diff --git a/NEWS b/NEWS
index 2b8f4ad..a1b8e16 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ vc-dwim NEWS                                          -*- 
outline -*-
 
   vc-chlog now detects removed files in a git tree.
 
+  vc-chlog accepts a --no-functions option to disable identifier extraction.
 
 * Noteworthy changes in release 1.1 (2009-06-20) [stable]
 
diff --git a/doc/vc-dwim.texi b/doc/vc-dwim.texi
index 3bbc95a..40b4c72 100644
--- a/doc/vc-dwim.texi
+++ b/doc/vc-dwim.texi
@@ -417,6 +417,10 @@ Use @var{name} as user name.
 @item --width @var{cols}
 Wrap @file{ChangeLog} entry at @var{cols} instead of 72.
 
address@hidden --no-functions
+Do not try to parse the names of functions or other identifiers
+that changed.
+
 @item --debug
 Inhibit temp file cleanup.
 
@@ -459,7 +463,8 @@ inclusively have been changed and end up as lines @var{c} 
through
 lines are denoted with a @code{0-0} pair.
 
 This information is passed to @code{func_extract_identifiers}, the heart
-of the script.  Now, for each changed file, it calls a helper function
+of the script.  Unless identifier extraction has been disabled with
address@hidden, for each changed file, it calls a helper function
 @code{func_taglist}, which uses @command{ctags -x} to obtain a list of
 identifiers in both the new, and the old version of the file.  These
 lists are ordered by line number.  Changes between two consecutive
diff --git a/tests/t-vc-chlog b/tests/t-vc-chlog
index 0b42f9c..de88aef 100755
--- a/tests/t-vc-chlog
+++ b/tests/t-vc-chlog
@@ -28,7 +28,9 @@ fi
 
 run_vc_chlog ()
 {
-  { vc-chlog --stdin < "$1" 2>stderr ||
+  infile=$1
+  shift
+  { vc-chlog --stdin ${1+"$@"} < "$infile" 2>stderr ||
     { echo; echo; echo vc-chlog failed; }; } |
       sed 1,2d > stdout
   test "$VERBOSE" != yes || { cat stdout; cat stderr >&2; }
@@ -342,6 +344,17 @@ cat >expected-emacs <<\EOF
 
 EOF
 
+# This is with --no-functions:
+cat >expected-no-functions <<\EOF
+       * add-several.c:
+       * append.c:
+       * moved.c:
+       * prepend.c:
+       * remove-several.c:
+       * several-changes-per-hunk.c:
+
+EOF
+
 $PATCH -p0 <p1 >stdout 2>stderr || fail=1
 test "$VERBOSE" != yes || { cat stdout; cat stderr >&2; }
 test "$fail" -ne 1
@@ -359,6 +372,9 @@ for file in expected-perfect expected-exuberant 
expected-emacs; do
 done
 $success
 
+run_vc_chlog p1 --no-functions
+$diff_u expected-no-functions stdout
+
 # Now for some error checking:
 
 ### broken diffs ###
diff --git a/vc-chlog.in b/vc-chlog.in
index bba880d..7f1ee30 100755
--- a/vc-chlog.in
+++ b/vc-chlog.in
@@ -40,6 +40,7 @@ Options:
       --tabsize COLS     assume tab stops at each COLS instead of 8
       --user-name NAME   use NAME as user name
       --width COLS       wrap ChangeLog entry at COLS instead of 72
+      --no-functions     do not try to find the names of changed functions
 
       --debug            inhibit temp file cleanup
       --help             display this help and exit
@@ -83,6 +84,7 @@ test -z "$user_name" &&
       }'`
 test -z "$email_address" &&
   address@hidden(domainname) 2>/dev/null || hostname -d`
+find_functions=:
 
 # From here on, uninitialized variables and unchecked commands are erroneous:
 set -eu
@@ -388,6 +390,7 @@ func_extract_identifiers ()
   nfile=0
   while read file strip diffstart diffend ranges; do
     echo "file: $file"
+    $find_functions || continue
     tagfile=$tmp/taglist-$nfile
     oldbase=oldfile-$nfile-`func_basename "$file"`
     oldfile=$tmp/$oldbase
@@ -600,6 +603,7 @@ while test $# -gt 0; do
   case $1 in
     --address)   email_address=$2; shift ;;
     --changelog) chlogs="$chlogs $2"; shift ;;
+    --no-functions) find_functions=false ;;
     --stdin)     stdin=: ;;
     --tabsize)   tabstop=$2; shift ;;
     --width)     textwidth=$2; shift ;;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]