Hi all,

Recent changes conflicted with my refactor-print-patches patch [1] so I
am posting an updated version of it, which should apply fine against
current CVS.

[1] http://lists.gnu.org/archive/html/quilt-dev/2005-06/msg00049.html

Does it sound like a good idea, or am I better forgetting about it?

Thanks,
-- 
Jean Delvare
Index: scripts/patchfns.in
===================================================================
RCS file: /cvsroot/quilt/quilt/scripts/patchfns.in,v
retrieving revision 1.62
diff -u -r1.62 patchfns.in
--- scripts/patchfns.in 6 Jun 2005 19:34:28 -0000       1.62
+++ scripts/patchfns.in 18 Jun 2005 14:36:14 -0000
@@ -752,6 +752,26 @@
        echo -n "${QUILT_PATCHES_PREFIX:+$SUBDIR_DOWN$QUILT_PATCHES/}$1"
 }
 
+print_patches()
+{
+       local verbose=$1 applied=$2
+       shift 2
+       local patch
+
+       local -a prefix
+       prefix=("  " "+ " "= ")
+
+       for patch in "$@"
+       do
+               if [ -n "$verbose" ]
+               then
+                       echo "${prefix[$applied]}$(print_patch "$patch")"
+               else
+                       echo "$(print_patch "$patch")"
+               fi
+       done
+}
+
 setup_colors()
 {
        local 
C=diff_hdr=32:diff_add=36:diff_mod=35:diff_rem=35:diff_hunk=33:diff_ctx=35:diff_cctx=33:patch_offs=33:patch_fuzz=35:patch_fail=31:clear=00
Index: quilt/patches.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/patches.in,v
retrieving revision 1.18
diff -u -r1.18 patches.in
--- quilt/patches.in    18 Jun 2005 13:15:57 -0000      1.18
+++ quilt/patches.in    18 Jun 2005 14:36:14 -0000
@@ -37,23 +37,23 @@
 
 scan_applied()
 {
-       local prefix=$1 file=$2
-       shift 2
+       local file=$1
+       shift
        local patch
 
        for patch in "$@"
        do
                if [ -f "$(backup_file_name $patch "$file")" ]
                then
-                       echo "$prefix$(print_patch $patch)"
+                       echo "$patch"
                fi
        done
 }
 
 scan_unapplied()
 {
-       local prefix=$1 file=$2
-       shift 2
+       local file=$1
+       shift
        local file_bre="$(quote_bre $file)" patch
 
        for patch in "$@"
@@ -61,7 +61,7 @@
                if touched_by_patch $(patch_strip_level $patch) $patch \
                   | grep -q "^$file_bre\$"
                then
-                       echo "$prefix$(print_patch $patch)"
+                       echo "$patch"
                fi
        done
 }
@@ -97,21 +97,12 @@
 
 top=$(top_patch)
 
-if [ -n "$opt_verbose" ]
+if [ -n "$top" ]
 then
-       applied="+ "
-       current="= "
-       unapplied="  "
-else
-       applied=""
-       current=""
-       unapplied=""
+       print_patches "$opt_verbose" 1 $(scan_applied "$opt_file" 
$(patches_before "$top"))
+       print_patches "$opt_verbose" 2 $(scan_applied "$opt_file" "$top")
 fi
-
-scan_applied "$applied" "$opt_file" $(patches_before $top)
-[ -n "$top" ] && \
-       scan_applied "$current" "$opt_file" $top
-scan_unapplied "$unapplied" "$opt_file" $(patches_after $top)
+print_patches "$opt_verbose" 0 $(scan_unapplied "$opt_file" $(patches_after 
"$top"))
 ### Local Variables:
 ### mode: shell-script
 ### End:
Index: quilt/series.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/series.in,v
retrieving revision 1.13
diff -u -r1.13 series.in
--- quilt/series.in     10 Jun 2005 22:17:04 -0000      1.13
+++ quilt/series.in     18 Jun 2005 14:36:14 -0000
@@ -33,18 +33,6 @@
        fi
 }
 
-cat_patches()
-{
-       local prefix=$1
-       shift
-       local patch
-
-       for patch in "$@"
-       do
-               echo "$prefix$(print_patch "$patch")"
-       done
-}
-
 options=`getopt -o vh -- "$@"`
 
 if [ $? -ne 0 ]
@@ -73,15 +61,14 @@
        usage
 fi
 
-if [ -n "$opt_verbose" ]
+top=$(top_patch)
+
+if [ -n "$top" ]
 then
-       top=$(top_patch)
-       cat_patches "+ " $(patches_before $top)
-       [ -n "$top" ] && cat_patches "= " $top
-       cat_patches "  " $(patches_after $top)
-else
-       cat_patches "" $(cat_series)
+       print_patches "$opt_verbose" 1 $(patches_before "$top")
+       print_patches "$opt_verbose" 2 "$top"
 fi
+print_patches "$opt_verbose" 0 $(patches_after "$top")
 ### Local Variables:
 ### mode: shell-script
 ### End:
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to