quilt/header.in | 16 +++++++++++++--- quilt/refresh.in | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) Index: quilt/header.in =================================================================== --- quilt/header.in.orig 2005-10-13 19:05:14.000000000 +0200 +++ quilt/header.in 2005-10-14 17:43:24.000000000 +0200 @@ -21,7 +21,7 @@ usage() { - printf $"Usage: quilt header [-a|-r|-e] [--backup] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n" + printf $"Usage: quilt header [-a|-r|-e] [--backup] [--orig] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n" if [ x$1 = x-h ] then @@ -41,6 +41,9 @@ --backup Create a backup copy of the old version of a patch as patch~. + +--orig + Create a backup copy of the original version of a patch as patch.orig. " "$EDITOR" exit 0 else @@ -77,7 +80,7 @@ fi } -options=`getopt -o areh --long backup,strip-trailing-whitespace,strip-diffstat -- "$@"` +options=`getopt -o areh --long backup,orig,strip-trailing-whitespace,strip-diffstat -- "$@"` if [ $? -ne 0 ] then @@ -101,6 +104,9 @@ --backup) QUILT_BACKUP=1 shift ;; + --orig) + QUILT_ORIG=1 + shift ;; --strip-diffstat) opt_strip_diffstat=1 shift ;; @@ -182,7 +188,11 @@ cat_file "$patch_file_or_null" | patch_body >> $tmp2 || exit 1 - if ( [ -z "$QUILT_BACKUP" -o ! -e $patch_file ] || \ + if ( [ -z "$QUILT_ORIG" -o -e $patch_file.orig ] || \ + ( [ ! -e $patch_file ] && \ + { touch $patch_file.orig ; true ; } || \ + mv $patch_file $patch_file.orig ) ) && \ + ( [ -z "$QUILT_BACKUP" -o ! -e $patch_file ] || \ mv $patch_file $patch_file~ ) && \ cat_to_new_file $patch_file < $tmp2 then Index: quilt/refresh.in =================================================================== --- quilt/refresh.in.orig 2005-10-14 15:14:27.000000000 +0200 +++ quilt/refresh.in 2005-10-14 16:15:01.000000000 +0200 @@ -19,7 +19,7 @@ usage() { - printf $"Usage: quilt refresh [-p n] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] [--strip-trailing-whitespace] [patch]\n" + printf $"Usage: quilt refresh [-p n] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] [--orig] [--strip-trailing-whitespace] [patch]\n" if [ x$1 = x-h ] then @@ -58,6 +58,9 @@ --backup Create a backup copy of the old version of a patch as patch~. +--orig + Create a backup copy of the original version of a patch as patch.orig. + --sort Sort files by their name instead of preserving the original order. --strip-trailing-whitespace @@ -79,7 +82,7 @@ } options=`getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup,sort \ - --long no-index \ + --long no-index,orig \ --long strip-trailing-whitespace -- "$@"` if [ $? -ne 0 ] @@ -119,6 +122,9 @@ --backup) QUILT_BACKUP=1 shift ;; + --orig) + QUILT_ORIG=1 + shift ;; --sort) opt_sort=1 shift ;; @@ -293,7 +299,11 @@ diff -q $patch_file $tmp_result > /dev/null then printf $"Patch %s is unchanged\n" "$(print_patch $patch)" -elif ( [ -z "$QUILT_BACKUP" -o ! -e $patch_file ] || \ +elif ( [ -z "$QUILT_ORIG" -o -e $patch_file.orig ] || \ + ( [ ! -e $patch_file ] && \ + { touch $patch_file.orig ; true ; } || \ + mv $patch_file $patch_file.orig ) ) && \ + ( [ -z "$QUILT_BACKUP" -o ! -e $patch_file ] || \ mv $patch_file $patch_file~ ) && \ cat_to_new_file $patch_file < $tmp_result then