diff options
-rw-r--r-- | lib/patchfns.in | 11 | ||||
-rw-r--r-- | quilt.changes | 14 | ||||
-rw-r--r-- | quilt/diff.in | 56 |
3 files changed, 68 insertions, 13 deletions
diff --git a/lib/patchfns.in b/lib/patchfns.in index f30ea13..4d57d5c 100644 --- a/lib/patchfns.in +++ b/lib/patchfns.in @@ -596,3 +596,14 @@ patch_description() ' $patch_file fi } + +in_array() +{ + local a=$1 + while [ $# -gt 1 ] + do + shift + [ "$a" = "$1" ] && return 0 + done + return 1 +} diff --git a/quilt.changes b/quilt.changes index 24849ad..e471c86 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Thu Jan 30 19:02:14 CET 2003 - agruen@suse.de + +- Allow a file list to be diffed to be passed to quilt diff. Add + -P option for specifying a patch different from the topmost + patch, + +------------------------------------------------------------------- +Thu Jan 20 12:11:00 EST 2003 - Martin.Quinson@ens-lyon.fr + +- Remove useless oldies. Missing functionnalities needs to be + reimplemented almost from the scratch due to the bunch of + changes to the core since those scripts were written. + +------------------------------------------------------------------- Thu Jan 30 13:25:51 CET 2003 - agruen@suse.de - Fix some regex quoting; use grep -E because we quote for extended regexps. Filenames with "+^$" in it did not work in some places. diff --git a/quilt/diff.in b/quilt/diff.in index 7f50b61..9f20cbd 100644 --- a/quilt/diff.in +++ b/quilt/diff.in @@ -24,20 +24,29 @@ usage() then redirect='>&2' fi - echo "Usage: quilt diff [-p n] [-c patch|-z] [patch]" $redirect + echo "Usage: quilt diff [-p n] [-c patch|-z] [-P patch] [file ...]" $redirect if [ x$1 = x-h ] then cat <<EOF +Produces a diff of the specified file(s) in the topmost or +specified patch. If no files are specified, all files that +are modified are included. + + Produce a diff of the specified patch, or the topmost patch by default. --p n Create a -p n style patch (-p0 or -p1 supported). +-p n Create a -p n style patch (-p0 or -p1 are supported). + +-P patch + Create a diff for the specified patch. (Defaults to + the topmost patch.) -c patch Create a combined diff for all patches between this - patch and the specified or topmost patch. + patch and the patch specified with -P. -z Write to standard output the changes that have been made relative to the topmost or specified patch. @@ -56,7 +65,7 @@ die () exit $status } -options=`getopt -o c:p:zh -- "$@"` +options=`getopt -o p:P:c:zh -- "$@"` if [ $? -ne 0 ] then @@ -71,6 +80,9 @@ do -p) opt_strip_level=$2 shift 2 ;; + -P) + last_patch=$(stripit $2) + shift 2 ;; -c) opt_combine=$2 shift 2 ;; @@ -85,20 +97,14 @@ do esac done +opt_files=( "$@" ) + if [ -n "$opt_combine" -a -n "$opt_relative" ] then echo "Options \`-c patch' and \`-z' cannot be combined." die 1 fi -if [ $# -eq 1 ] -then - last_patch=$(stripit $1) -elif [ $# -gt 1 ] -then - usage -fi - if [ -z "$last_patch" ] then last_patch=$(top_patch) @@ -151,12 +157,36 @@ then while read file first garbage do + if [ ${#opt_files[@]} -gt 0 ] && \ + ! in_array "$file" "${opt_files[@]}" + then + continue + fi patches[${#patches[@]}]="$first" files[${#files[@]}]="$file" done \ < <(modified_files -- "$@") else - files=( $(files_in_patch $last_patch) ) + for file in $(files_in_patch $last_patch) + do + if [ ${#opt_files[@]} -gt 0 ] && \ + ! in_array "$file" "${opt_files[@]}" + then + continue + fi + files[${#files[@]}]="$file" + done +fi + +if [ ${#opt_files[@]} -gt 0 ] +then + for file in "${opt_files[@]}" + do + if ! in_array "$file" "${files[@]}" + then + echo "File $file is not being modified." + fi + done fi trap "die 1" SIGTERM |