|
Hi, I have some patches that implement some enhancements to the "quilt header" command. These have been helpful to us, and I thought others might find them useful. quilt-header_templates.patch -- Joe Green <[EMAIL PROTECTED]> MontaVista Software, Inc. |
Source: MontaVista Software, Inc. <[EMAIL PROTECTED]> Type: Enhancement Disposition: submit to http://savannah.nongnu.org/projects/quilt Add support for header templates when there is no patch header and editor is invoked. Index: quilt-0.42/quilt/header.in =================================================================== --- quilt-0.42.orig/quilt/header.in +++ quilt-0.42/quilt/header.in @@ -174,6 +174,20 @@ else if [ -n "$opt_edit" ] then + if ! [ -s "$tmp" ] + then + for template in \ + $QUILT_PATCHES/quilt.header \ + $HOME/.quilt.header \ + /etc/quilt.header + do + if [ -e "$template" ] + then + cat "$template" > $tmp + break + fi + done + fi $EDITOR "$tmp" || exit 1 fi
Source: MontaVista Software, Inc. <[EMAIL PROTECTED]> Type: Enhancement Disposition: submit to http://savannah.nongnu.org/projects/quilt Add support for comments in header templates that will be automatically stripped out after the header is edited. Comments are any line that begins with "//". Index: quilt-0.42/quilt/header.in =================================================================== --- quilt-0.42.orig/quilt/header.in +++ quilt-0.42/quilt/header.in @@ -183,12 +183,17 @@ else do if [ -e "$template" ] then - cat "$template" > $tmp + cat "$template" > "$tmp2" break fi done + else + cat "$tmp" > "$tmp2" fi - $EDITOR "$tmp" || exit 1 + + $EDITOR "$tmp2" || exit 1 + + grep -v "^//" < "$tmp2" > "$tmp" fi maybe_strip_diffstat < $tmp \
Source: MontaVista Software, Inc. <[EMAIL PROTECTED]> Type: Enhancement Disposition: submit to http://savannah.nongnu.org/projects/quilt Add "--pad" option to header command to allow forced padding by a specified number of blank lines. Index: quilt-0.42/quilt/header.in =================================================================== --- quilt-0.42.orig/quilt/header.in +++ quilt-0.42/quilt/header.in @@ -21,7 +21,7 @@ fi usage() { - printf $"Usage: quilt header [-a|-r|-e] [--backup] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n" + printf $"Usage: quilt header [-a|-r|-e] [--backup] [--pad[=n]] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n" if [ x$1 = x-h ] then @@ -33,6 +33,10 @@ Print or change the header of the topmos edit (-e) the header in \$EDITOR (%s). If none of these options is given, print the patch header. +--pad[=n] + Make sure a new header ends with at least \"n\" blank lines. + If \"--pad\" is specified alone, \"n\" is assumed to be 1. + --strip-diffstat Strip diffstat output from the header. @@ -48,6 +52,23 @@ Print or change the header of the topmos fi } +maybe_pad_header() +{ + [ "$opt_pad" ] || opt_pad=0 + @AWK@ -v pad=$opt_pad ' + BEGIN { blanks = pad } + { print } + /^[ \t]*$/ { blanks += 1; next } + { blanks = 0 } + END { + while (blanks < pad) { + print "" + blanks += 1 + } + } + ' +} + maybe_strip_trailing_whitespace() { if [ -n "$opt_strip_trailing_whitespace" ] @@ -77,7 +98,7 @@ maybe_strip_diffstat() fi } -options=`getopt -o areh --long backup,strip-trailing-whitespace,strip-diffstat -- "$@"` +options=`getopt -o areh --long backup,pad::,strip-trailing-whitespace,strip-diffstat -- "$@"` if [ $? -ne 0 ] then @@ -101,6 +122,16 @@ do --backup) QUILT_BACKUP=1 shift ;; + --pad) + case "$2" in + "") + opt_pad=1 ;; + [0-9]) + opt_pad="$2" ;; + *) + usage ;; + esac + shift 2 ;; --strip-diffstat) opt_strip_diffstat=1 shift ;; @@ -197,7 +228,8 @@ else fi maybe_strip_diffstat < $tmp \ - | maybe_strip_trailing_whitespace > $tmp2 + | maybe_strip_trailing_whitespace \ + | maybe_pad_header > $tmp2 cat_file "$patch_file_or_null" | patch_body >> $tmp2 || exit 1
_______________________________________________ Quilt-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/quilt-dev
