summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO16
-rw-r--r--quilt.changes7
-rw-r--r--quilt.quiltrc1
-rw-r--r--quilt/diff.in19
-rw-r--r--quilt/push.in60
-rw-r--r--scripts/patchfns.in9
6 files changed, 93 insertions, 19 deletions
diff --git a/TODO b/TODO
index f0d96ae..795a8f5 100644
--- a/TODO
+++ b/TODO
@@ -15,9 +15,6 @@ General:
- Support different diff/patch options for different patches.
(By specifying them in the series file?)
- - Syntax coloring: Allow to change the colors (for reverse video,
- ...)
-
- Add command that generates a summary (patch names + descriptions).
- Add command to extract a header.
@@ -25,6 +22,9 @@ General:
- Add more long-form options, and add some nagative options so that
defaults from .quiltrc can easily be overruled.
+ - series.conf: Allow to specify options like -R, -u, -Unum, -c,
+ -Cnum per patch.
+
Documentation:
- How to import a complete directory before doing wild changes?
@@ -41,7 +41,9 @@ quilt push:
- Add option to print the reject to stdout
- - Syntax color patch output (fuzz and rejects)
+ - If push fails, check if patch can be reversed.
+
+ - Add -l option to ignore whitespace changes.
quilt pop:
@@ -53,6 +55,8 @@ quilt diff:
- Error message when a file is specified that isn't in the
patch(es).
+ - When a directory is specified, diff all files below it.
+
quilt refresh:
- Add an -m option similar to `cvs commit -m "..."' to simplify
@@ -82,6 +86,10 @@ quit edit:
- Check for actual changes, and remove files again that haven't been
changed.
+quilt files:
+
+ - Print filenames relative to the working directory.
+
quilt mail:
- Improve recipient handling (quote special characters automatically;
diff --git a/quilt.changes b/quilt.changes
index c0fb776..0ca72b0 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Sun Jan 23 19:27:17 CET 2005 - agruen@suse.de
+
+- Add color support for push command output and allow to customize
+ colors via the QUILT_COLORS environment variable (for reverse
+ video, etc.).
+
+-------------------------------------------------------------------
Sun Jan 23 05:03:08 CET 2005 - agruen@suse.de
- Add mail command, doc/README.MAIL and example ``mail'' command
diff --git a/quilt.quiltrc b/quilt.quiltrc
index a2d2ede..2240742 100644
--- a/quilt.quiltrc
+++ b/quilt.quiltrc
@@ -6,6 +6,7 @@ QUILT_DIFF_OPTS="--show-c-function"
#QUILT_PATCH_OPTS="--ignore-whitespace"
# Options to pass to commands (QUILT_${COMMAND}_ARGS)
+QUILT_PUSH_ARGS="--color=auto"
QUILT_DIFF_ARGS="--no-timestamps --color=auto"
QUILT_REFRESH_ARGS="--no-timestamps --backup"
diff --git a/quilt/diff.in b/quilt/diff.in
index 15d182e..f336a66 100644
--- a/quilt/diff.in
+++ b/quilt/diff.in
@@ -17,6 +17,8 @@ then
. @SCRIPTS@/patchfns
fi
+setup_colors
+
usage()
{
printf $"Usage: quilt diff [-p n] [-u|-U num|-c|-C num] [--combine patch|-z] [-R] [-P patch] [--snapshot] [--diff=utility] [--color] [file ...]\n"
@@ -71,18 +73,21 @@ included.
colorize() {
if [ -n "$opt_color" ]; then
@AWK@ '
- function esc(x) { return "'$'\e''[" x "m" }
{ if (/^(Index:|\-\-\-|\+\+\+|\*\*\*) /)
- print esc(32) $0 esc(0)
+ print "'$color_diff_hdr'" $0 "'$color_clear'"
else if (/^\+/)
- print esc(36) $0 esc(0)
- else if (/^(\-|!)/)
- print esc(35) $0 esc(0)
+ print "'$color_diff_add'" $0 "'$color_clear'"
+ else if (/^-/)
+ print "'$color_diff_rem'" $0 "'$color_clear'"
+ else if (/^!/)
+ print "'$color_diff_mod'" $0 "'$color_clear'"
else if (/^@@ \-[0-9]+(,[0-9]+)? \+[0-9]+(,[0-9]+)? @@/)
print gensub(/^(@@[^@]*@@)([ \t]*)(.*)/,
- esc(33) "\\1" esc(0) "\\2" esc(35) "\\3" esc(0), "")
+ "'$color_diff_hunk'" "\\1" "'$color_clear'" \
+ "\\2" \
+ "'$color_diff_ctx'" "\\3" "'$color_clear'", "")
else if (/^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/)
- print esc(33) $0 esc(0)
+ print "'$color_diff_cctx'" $0 "'$color_clear'"
else
print
}'
diff --git a/quilt/push.in b/quilt/push.in
index 757cc2b..300f390 100644
--- a/quilt/push.in
+++ b/quilt/push.in
@@ -17,6 +17,8 @@ then
. @SCRIPTS@/patchfns
fi
+setup_colors
+
usage()
{
printf $"Usage: quilt push [-afqv] [--leave-rejects] [num|patch]\n"
@@ -46,6 +48,9 @@ be used.
Allow the patch utility to ask how to deal with conflicts. If
this option is not given, the option -f will be passed to the
patch program.
+
+--color[=always|auto|never]
+ Use syntax coloring.
"
exit 0
else
@@ -61,6 +66,26 @@ interrupt()
exit 1
}
+colorize()
+{
+ if [ -n "$opt_color" ]; then
+ @AWK@ '
+ { if (/FAILED/)
+ print "'$color_patch_fail'" $0 "'$color_clear'"
+ else if (/^Hunk/) {
+ sub(/^Hunk .* with fuzz [0-9]*/,
+ "'$color_patch_fuzz'&'$color_clear'")
+ sub(/offset -?[0-9]* lines?/,
+ "'$color_patch_offs'&'$color_clear'")
+ print
+ } else
+ print
+ }'
+ else
+ cat
+ fi
+}
+
apply_patch()
{
local patch=$1
@@ -141,9 +166,8 @@ add_patch()
no_reject_files="-r $tmp"
fi
- apply_patch $patch \
- | cleanup_patch_output
- status=${PIPESTATUS[0]}
+ apply_patch $patch
+ status=${PIPESTATUS[0]]}
trap "" SIGINT
if [ $status -eq 0 -o -n "$opt_force" ]
@@ -218,7 +242,7 @@ list_patches()
fi
}
-options=`getopt -o fqvah --long leave-rejects,interactive -- "$@"`
+options=`getopt -o fqvah --long leave-rejects,interactive,color:: -- "$@"`
if [ $? -ne 0 ]
then
@@ -250,6 +274,19 @@ do
--interactive)
opt_interactive=1
shift ;;
+ --color)
+ case "$2" in
+ "" | always)
+ opt_color=1 ;;
+ auto | tty)
+ opt_color=
+ [ -t 1 ] && opt_color=1 ;;
+ never)
+ opt_color= ;;
+ *)
+ usage ;;
+ esac
+ shift 2 ;;
--)
shift
break ;;
@@ -322,10 +359,17 @@ do
then
exit 1
fi
- [ -z "$opt_quiet" ] && echo
-done
-
-printf $"Now at patch %s\n" "$(print_patch $patch)"
+ [ -n "$opt_quiet" ] || echo
+done \
+| cleanup_patch_output \
+| colorize
+
+if [ ${PIPESTATUS[0]} -eq 0 ]; then
+ set -- $patches
+ printf $"Now at patch %s\n" "$(print_patch ${!#})"
+else
+ exit 1
+fi
### Local Variables:
### mode: shell-script
### End:
diff --git a/scripts/patchfns.in b/scripts/patchfns.in
index 0e9b306..25e92af 100644
--- a/scripts/patchfns.in
+++ b/scripts/patchfns.in
@@ -761,6 +761,15 @@ print_patch() {
echo -n "${QUILT_PATCHES_PREFIX:+$SUBDIR_DOWN$QUILT_PATCHES/}$1"
}
+setup_colors()
+{
+ local C=${QUILT_COLORS:-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
+
+ C=${C//=/=\'$'\e'[}
+ C=color_${C//:/m\'; color_}m\'
+ eval $C
+}
+
#
# If the working directory does not contain a $QUILT_PATCHES directory,
# quilt searches for its base directory up the directory tree. If no