zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 2/2] vcs_info quilt: Pass patch subject lines to gen-applied-string
@ 2015-10-22 12:30 Daniel Shahaf
  2015-10-24 20:25 ` Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Shahaf @ 2015-10-22 12:30 UTC (permalink / raw)
  To: zsh-workers

The format used is '${patchname} ${subject}', which is analogous to the
git backend.
---
This seems to work with both Debian and Fedora source packages.  In
Debian the first line sometimes starts with "Description:" (DEP-3 format
patches); perhaps that prefix should be removed, but for now I've erred
on the side of conservatism and left the first line unmunged.

 Functions/VCS_Info/VCS_INFO_quilt | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
index 1466e07..496b5b6 100644
--- a/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -145,6 +145,22 @@ function VCS_INFO_quilt() {
         unapplied=()
     fi
 
+    if [[ -n $patches ]]; then
+      () {
+        local i line
+        for ((i=1; i<=$#applied; i++)); do
+          read -r line < "$patches/$applied[$i]" &&
+          [[ line != (#b)(---|Index:) ]] &&
+            applied[$i]+=" $line"
+        done
+        for ((i=1; i<=$#unapplied; i++)); do
+          read -r line < "$patches/$unapplied[$i]" &&
+          [[ line != (#b)(---|Index:) ]] &&
+            unapplied[$i]+=" $line"
+        done
+      }
+    fi
+
     all=( ${(Oa)applied} ${unapplied} )
 
     if VCS_INFO_hook 'gen-applied-string' "${applied[@]}"; then
-- 
2.1.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] vcs_info quilt: Pass patch subject lines to gen-applied-string
  2015-10-22 12:30 [PATCH 2/2] vcs_info quilt: Pass patch subject lines to gen-applied-string Daniel Shahaf
@ 2015-10-24 20:25 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2015-10-24 20:25 UTC (permalink / raw)
  To: zsh-workers

Daniel Shahaf wrote on Thu, Oct 22, 2015 at 12:30:57 +0000:
> The format used is '${patchname} ${subject}', which is analogous to the
> git backend.
> ---
> This seems to work with both Debian and Fedora source packages.  In
> Debian the first line sometimes starts with "Description:" (DEP-3 format
> patches); perhaps that prefix should be removed, but for now I've erred
> on the side of conservatism and left the first line unmunged.

I've updated the patch to fix a few problems:

- Fix filtering of (---|Index:) — the condition was always false
- Don't leak error to terminal if the patch file doesn't exist
  (eg after 'quilt new')
- Add "?" as subject if the patch has none

Interdiff:

diff -u b/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
--- b/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -149,14 +149,28 @@
       () {
         local i line
         for ((i=1; i<=$#applied; i++)); do
-          read -r line < "$patches/$applied[$i]" &&
-          [[ line != (#b)(---|Index:) ]] &&
+          if [[ -f "$patches/$applied[$i]" ]] &&
+             read -r line < "$patches/$applied[$i]" &&
+             [[ $line != (#b)(---|Index:)* ]] &&
+             true
+            ;
+          then
             applied[$i]+=" $line"
+          else
+            applied[$i]+=" ?"
+          fi
         done
         for ((i=1; i<=$#unapplied; i++)); do
-          read -r line < "$patches/$unapplied[$i]" &&
-          [[ line != (#b)(---|Index:) ]] &&
+          if [[ -f "$patches/$unapplied[$i]" ]] &&
+             read -r line < "$patches/$unapplied[$i]" &&
+             [[ $line != (#b)(---|Index:)* ]] &&
+             true
+            ;
+          then
             unapplied[$i]+=" $line"
+          else
+            unapplied[$i]+=" ?"
+          fi
         done
       }
     fi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-24 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 12:30 [PATCH 2/2] vcs_info quilt: Pass patch subject lines to gen-applied-string Daniel Shahaf
2015-10-24 20:25 ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).