quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [patch 1/2] Move the code that computes a range of patches f


From: hugo-qlt
Subject: [Quilt-dev] [patch 1/2] Move the code that computes a range of patches from mail to patchfns.
Date: Thu, 26 Nov 2009 20:32:55 +0000
User-agent: quilt/0.48-1

This prepares for using the function in commit.

Signed-off-by: Hugo Mills <address@hidden>
Index: quilt/quilt/scripts/patchfns.in
===================================================================
--- quilt.orig/quilt/scripts/patchfns.in        2009-11-26 16:10:28.000000000 
+0000
+++ quilt/quilt/scripts/patchfns.in     2009-11-26 19:41:00.000000000 +0000
@@ -437,6 +437,36 @@
        [ -n "$patch" ] && echo "$patch"
 }
 
+list_patch_range()
+{
+       local first_patch="$1" last_patch="$2"
+
+       if [ -n "$first_patch" ]
+       then
+               if [ -n "$last_patch" ]
+               then
+                       set -- $(patches_before "$last_patch") "$last_patch"
+                       while [ $# -ne 0 ]
+                       do
+                               [ "$1" = "$first_patch" ] && break
+                               shift
+                       done
+                       if [ $# -eq 0 ]
+                       then
+                               printf $"Patch %s not applied before patch 
%s\n" \
+                                       "$(print_patch $first_patch)" \
+                                       "$(print_patch $last_patch)" >&2
+                               return 1
+                       fi
+                       echo "$@"
+               else
+                       echo "$first_patch" $(patches_after "$first_patch")
+               fi
+       else
+               cat_series
+       fi
+}
+
 # List all patches that have been applied on top of patch $1
 patches_on_top_of()
 {
Index: quilt/quilt/mail.in
===================================================================
--- quilt.orig/quilt/mail.in    2009-11-26 16:10:48.000000000 +0000
+++ quilt/quilt/mail.in 2009-11-26 16:13:46.000000000 +0000
@@ -369,31 +369,7 @@
        }
 fi
 
-if [ -n "$first_patch" ]
-then
-       if [ -n "$last_patch" ]
-       then
-               set -- $(patches_before "$last_patch") "$last_patch"
-               while [ $# -ne 0 ]
-               do
-                       [ "$1" = "$first_patch" ] && break
-                       shift
-               done
-               if [ $# -eq 0 ]
-               then
-                       printf $"Patch %s not applied before patch %s\n" \
-                              "$(print_patch $first_patch)" \
-                              "$(print_patch $last_patch)" >&2
-                       exit 1
-               fi
-               patches=( "$@" )
-       else
-               patches=( "$first_patch" $(patches_after "$first_patch") )
-       fi
-else
-       patches=( $(cat_series) )
-fi
-
+patches=( $(list_patch_range "$first_patch" "$last_patch") )
 address@hidden
 
 tmpdir=$(gen_tempfile -d)






reply via email to

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