[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] [PATCH 2/2] quilt patches: Add support for multiple file
From: |
Martin Quinson |
Subject: |
Re: [Quilt-dev] [PATCH 2/2] quilt patches: Add support for multiple files |
Date: |
Wed, 22 May 2013 01:13:01 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
I did not really test your code, but I read it and it seems very
reasonnable to me. You should commit it I guess.
Thanks for your time,
Mt
On Tue, Apr 30, 2013 at 02:36:59PM +0200, Jean Delvare wrote:
> Add support for multiple files to "quilt patches". Patches will be
> printed, that modify any of the listed files.
> ---
> quilt/patches.in | 67
> ++++++++++++++++++++++++++++++++++++-------------------
> 1 file changed, 45 insertions(+), 22 deletions(-)
>
> --- a/quilt/patches.in
> +++ b/quilt/patches.in
> @@ -17,13 +17,15 @@ then
> . $QUILT_DIR/scripts/patchfns
> fi
>
> +declare -a opt_files=()
> +
> usage()
> {
> - printf $"Usage: quilt patches [-v] {file}\n"
> + printf $"Usage: quilt patches [-v] {file} [files...]\n"
> if [ x$1 = x-h ]
> then
> printf $"
> -Print the list of patches that modify the specified file. (Uses a
> +Print the list of patches that modify any of the specified files. (Uses a
> heuristic to determine which files are modified by unapplied patches.
> Note that this heuristic is much slower than scanning applied patches.)
>
> @@ -38,18 +40,26 @@ Note that this heuristic is much slower
> fi
> }
>
> +# Uses global variable opt_files
> scan_applied()
> {
> - local color=$1 prefix=$2 file=$3
> - shift 3
> - local patch
> + local color=$1 prefix=$2
> + shift 2
> + local patch file match
>
> for patch in "$@"
> do
> - if [ -f "$(backup_file_name $patch "$file")" ]
> - then
> - echo "$color$prefix$(print_patch $patch)$color_clear"
> - fi
> + match=
> + for file in "address@hidden"
> + do
> + if [ -f "$(backup_file_name $patch "$file")" ]
> + then
> + match=1
> + break
> + fi
> + done
> +
> + [ -z "$match" ] || echo "$color$prefix$(print_patch
> $patch)$color_clear"
> done
> }
>
> @@ -74,22 +84,31 @@ touched_by_patch()
> }'
> }
>
> +# Uses global variable opt_files
> scan_unapplied()
> {
> - local color=$1 prefix=$2 file=$3 strip
> - shift 3
> - local file_bre="$(quote_bre $file)" patch
> + local color=$1 prefix=$2 strip
> + shift 2
> + local patch file file_bre match
>
> for patch in "$@"
> do
> strip=$(patch_strip_level $patch)
> [ "$strip" = ab ] && strip=1
>
> - if touched_by_patch $strip $patch \
> - | grep -q "^$file_bre\$"
> - then
> - echo "$color$prefix$(print_patch $patch)$color_clear"
> - fi
> + match=
> + for file in "address@hidden"
> + do
> + file_bre="$(quote_bre "$file")"
> + if touched_by_patch $strip $patch \
> + | grep -q "^$file_bre\$"
> + then
> + match=1
> + break
> + fi
> + done
> +
> + [ -z "$match" ] || echo "$color$prefix$(print_patch
> $patch)$color_clear"
> done
> }
>
> @@ -129,11 +148,15 @@ do
> esac
> done
>
> -if [ $# -ne 1 ]
> +if [ $# -lt 1 ]
> then
> usage
> fi
> -opt_file="$SUBDIR$1"
> +while [ $# -ge 1 ]
> +do
> + address@hidden"$SUBDIR$1"
> + shift
> +done
>
> top=$(top_patch)
>
> @@ -152,12 +175,12 @@ fi
>
> setup_pager
>
> -scan_applied "$color_series_app" "$applied" "$opt_file" \
> +scan_applied "$color_series_app" "$applied" \
> $(patches_before $top)
> [ -n "$top" ] && \
> - scan_applied "$color_series_top" "$current" "$opt_file" \
> + scan_applied "$color_series_top" "$current" \
> $top
> -scan_unapplied "$color_series_una" "$unapplied" "$opt_file" \
> +scan_unapplied "$color_series_una" "$unapplied" \
> $(patches_after $top)
>
> ### Local Variables:
>
> --
> Jean Delvare
> Suse L3
>
>
> _______________________________________________
> Quilt-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/quilt-dev
--
Le soir, on regarde la télévision, puisque s'aimer, c'est regarder dans la
même direction. -- Les malpolis
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Quilt-dev] [PATCH 2/2] quilt patches: Add support for multiple files,
Martin Quinson <=