quilt-dev
[Top][All Lists]
Advanced

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

Bugfix for insertion of patch at beginning of series (Was Re: [Quilt-dev


From: Joe Green
Subject: Bugfix for insertion of patch at beginning of series (Was Re: [Quilt-dev] CVS / source control support)
Date: Thu, 25 Aug 2005 11:50:11 -0700
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

Dean Roehrich wrote:
@@ -192,6 +226,7 @@ insert_in_series()
 {
 	local patch=$1 patch_args=$2
 	local top=$(top_patch) tmpfile
+	local new_series=no
 
 	if [ -n "$patch_args" ]
 	then
@@ -227,8 +262,24 @@ insert_in_series()
 	else
 		echo "$patch$patch_args" > $tmpfile
 	fi
    

Hmm, does your workarea match what's currently at the top of the CVS tree?
  
Sorry, looks like there's a bugfix patch I forgot to post.  The CVS patches are also dependent on this one.

When you create a new patch at the beginning of a series, this patch is inserted at the beginning of the series file, regardless of any directives or comments.  If inserted before directives, this can break future "quilt setup" operations on the series file.  The attached patch changes insert_in_series to insert the patch just before the first existing patch in the series file.  An alternative would be to change to looking for the "next patch", and always insert right before that.

-- 
Joe Green <address@hidden>
MontaVista Software, Inc.
Source: MontaVista Software, Inc. <address@hidden>
Type: Defect Fix
Disposition: submit to http://savannah.nongnu.org/projects/quilt

Don't insert first patch before any initial directives or comments.

Index: quilt-0.42/scripts/patchfns.in
===================================================================
--- quilt-0.42.orig/scripts/patchfns.in
+++ quilt-0.42/scripts/patchfns.in
@@ -200,13 +200,25 @@ insert_in_series()
 
        tmpfile=$(gen_tempfile) || return 1
        mkdir -p $(dirname $SERIES)
-       if [ -n "$top" ]
+       if [ -e "$SERIES" ]
        then
-               @AWK@ '
+               if [ -n "$top" ]
+               then
+                       @AWK@ '
                                { print }
-               /^'"$(quote_re $top)"'([ \t]|$)/ \
+                       /^'"$(quote_re $top)"'([ \t]|$)/ \
                                { print "'"$patch$patch_args"'" }
-               ' $SERIES > $tmpfile
+                       ' $SERIES > $tmpfile
+               else
+                       @AWK@ '
+                       BEGIN   { insert = 1 }
+                       /^$/    { print; next }
+                       /^#/    { print; next }
+                       insert  { print "'"$patch$patch_args"'"; insert = 0 }
+                               { print }
+                       END     { if (insert) print "'"$patch$patch_args"'" }
+                       ' $SERIES > $tmpfile
+               fi
                status=$?
                if [ $status -ne 0 ]
                then
@@ -215,10 +227,6 @@ insert_in_series()
                fi
        else
                echo "$patch$patch_args" > $tmpfile
-               if [ -e $SERIES ]
-               then
-                       cat $SERIES >> $tmpfile
-               fi
        fi
        cat $tmpfile > $SERIES
        rm -f $tmpfile

reply via email to

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