quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH] Enhanced decoration for "series -v" command


From: Peter Williams
Subject: [Quilt-dev] [PATCH] Enhanced decoration for "series -v" command
Date: Fri, 10 Jun 2005 16:21:28 +1000
User-agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324)

I am the author of a PyGTK GUI wrapper ( see <http://freshmeat.net/projects/gquilt/>) for quilt and it has been suggested to me that the panel containing the display of the patch series could be enhanced by having it display (for applied patches) whether each patch needs refreshing or not.

The attached patch modifies quilt's "series -v" command to add this information to the output. With this patch the following prefices are applied to each patch displayed:

"+ " -- if the patch is applied, is not the top patch and does not need a refresh "? " -- if the patch is applied and is not the top patch but needs a refresh "= " -- if the patch is applied, is the top patch and does not need a refresh
"! "  -- if the patch is applied and is the top patch but needs a refresh

Your comments are requested.

Thanks,
Peter
--
Peter Williams                                   address@hidden

"Learning, n. The kind of ignorance distinguishing the studious."
 -- Ambrose Bierce
Index: quilt/quilt/series.in
===================================================================
--- quilt.orig/quilt/series.in
+++ quilt/quilt/series.in
@@ -78,8 +78,24 @@ fi
 if [ -n "$opt_verbose" ]
 then
        top=$(top_patch)
-       cat_patches "+ " $(patches_before $top)
-       [ -n "$top" ] && cat_patches "= " $top
+       for patch in $(patches_before $top)
+       do
+               if files_may_have_changed $patch
+               then
+                       echo "? $(print_patch "$patch")"
+               else
+                       echo "+ $(print_patch "$patch")"
+               fi
+       done
+       if [ -n "$top" ]
+       then
+               if files_may_have_changed $top
+               then
+                       echo "! $(print_patch "$top")"
+               else
+                       echo "= $(print_patch "$top")"
+               fi
+       fi
        cat_patches "  " $(patches_after $top)
 else
        cat_patches "" $(cat_series)
Index: quilt/quilt/pop.in
===================================================================
--- quilt.orig/quilt/pop.in
+++ quilt/quilt/pop.in
@@ -76,28 +76,6 @@ list_patches()
        fi
 }
 
-files_may_have_changed()
-{
-       local patch=$1 file
-       local patch_file=$(patch_file_name $patch)
-       
-       if [ $? -ne 0 -o ! -e "$patch_file" \
-            -o ! -e "$QUILT_PC/$patch/.timestamp" \
-            -o "$QUILT_PC/$patch/.timestamp" -ot "$patch_file" ]
-       then
-               return 0
-       fi
-       
-       local apply_ts=$(date -r "$QUILT_PC/$patch/.timestamp" '+%s') ts
-       for file in $(files_in_patch $patch)
-       do
-               ts=$(date -r $file '+%s' 2> /dev/null)
-               [ -z "$ts" ] && return 0
-               [ "$ts" -gt $apply_ts ] && return 0
-       done
-       return 1
-}
-
 # Check if all changes have been folded back into the patch (quilt refresh),
 # and report any pending changes.
 check_for_pending_changes()
Index: quilt/scripts/patchfns.in
===================================================================
--- quilt.orig/scripts/patchfns.in
+++ quilt/scripts/patchfns.in
@@ -325,6 +325,28 @@ is_applied()
        grep -q -E "^$(quote_re $patch)\$" $DB
 }
 
+files_may_have_changed()
+{
+       local patch=$1 file
+       local patch_file=$(patch_file_name $patch)
+
+       if [ $? -ne 0 -o ! -e "$patch_file" \
+            -o ! -e "$QUILT_PC/$patch/.timestamp" \
+            -o "$QUILT_PC/$patch/.timestamp" -ot "$patch_file" ]
+       then
+               return 0
+       fi
+
+       local apply_ts=$(date -r "$QUILT_PC/$patch/.timestamp" '+%s') ts
+       for file in $(files_in_patch $patch)
+       do
+               ts=$(date -r $file '+%s' 2> /dev/null)
+               [ -z "$ts" ] && return 0
+               [ "$ts" -gt $apply_ts ] && return 0
+       done
+       return 1
+}
+
 applied_patches()
 {
        [ -e $DB ] || return 1

reply via email to

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