quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [patch] add option to "quilt refresh" to save original versi


From: Olaf Dabrunz
Subject: [Quilt-dev] [patch] add option to "quilt refresh" to save original version of a patch
Date: Thu, 13 Oct 2005 20:41:51 +0200
User-agent: Mutt/1.5.9i

This patch adds option "--orig" to "quilt refresh". It saves the
original version of a patch as patch.orig.

Maybe the additional logic looks a bit convoluted now.

Index: quilt-0.42/quilt/refresh.in
===================================================================
--- quilt-0.42.orig/quilt/refresh.in
+++ quilt-0.42/quilt/refresh.in
@@ -19,7 +19,7 @@ fi
 
 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 @@ patch.
 --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 @@ die ()
 }
 
 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 @@ do
        --backup)
                QUILT_BACKUP=1
                shift ;;
+       --orig)
+               QUILT_ORIG=1
+               shift ;;
        --sort)
                opt_sort=1
                shift ;;
@@ -293,7 +299,11 @@ if [ -e $patch_file ] && \
    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


-- 
Olaf Dabrunz (od/odabrunz), SUSE Linux Products GmbH, Nürnberg





reply via email to

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