diff options
author | Andreas Gruenbacher <agruen@schurl.novell.linbit> | 2009-11-19 03:16:00 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2009-11-20 22:55:22 +0100 |
commit | 0ba994a91b0e5fa26b79e783b4b9c5568e712da3 (patch) | |
tree | c41972c172cd89605daea2a4053c6492fd9e3d3e | |
parent | cfaa6e0db5cd73f655dc6388311dff0da5d4bfcf (diff) | |
download | quilt-0ba994a91b0e5fa26b79e783b4b9c5568e712da3.tar.gz |
pager support: some improvements
When QUILT_PAGER is set to an empty value, do not paginate.
Document QUILT_PAGER in the man page.
Clean things up a little.
Add a workaround in quilt.quiltrc for color output when $LESS is defined.
-rw-r--r-- | doc/quilt.1.in | 7 | ||||
-rw-r--r-- | quilt.changes | 11 | ||||
-rw-r--r-- | quilt.quiltrc | 4 | ||||
-rw-r--r-- | quilt/scripts/patchfns.in | 39 |
4 files changed, 39 insertions, 22 deletions
diff --git a/doc/quilt.1.in b/doc/quilt.1.in index 39ae680..85ba44e 100644 --- a/doc/quilt.1.in +++ b/doc/quilt.1.in @@ -200,6 +200,13 @@ If this variable is set to anything, no timestamp will be included. This is a shortcut to adding --no-timestamps to both QUILT_DIFF_ARGS and QUILT_REFRESH_ARGS. +.IP QUILT_PAGER 4 + +Th pager quilt shall use for commands which produce paginated output. If +unset, the values of GIT_PAGER or PAGER is used. If none of these variables +is set, "less" is used. An empty value indicates that no pager should be +used. + .IP EDITOR 4 The program to run to edit files. If it isn't redefined in the diff --git a/quilt.changes b/quilt.changes index 99fa25b..244fb00 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,15 @@ ------------------------------------------------------------------- +Fri Nov 20 22:43:33 CET 2009 - agruen@suse.de + +- Add pagination support (code based on topgit; patch from Bert + Wesarg <bert.wesarg@googlemail.com>). +- When QUILT_PAGER is set to an empty value, do not paginate. +- Document QUILT_PAGER in the man page. +- Clean things up a little. +- Add a workaround in quilt.quiltrc for color output when $LESS + is defined. + +------------------------------------------------------------------- Fri Nov 20 20:40:55 CET 2009 - pth@novell.com - Enable quilt to handle compressed tarballs and patches that were diff --git a/quilt.quiltrc b/quilt.quiltrc index b815d32..cd44500 100644 --- a/quilt.quiltrc +++ b/quilt.quiltrc @@ -18,6 +18,10 @@ QUILT_REFRESH_ARGS="--no-timestamps --backup" QUILT_SERIES_ARGS="--color=auto" QUILT_PATCHES_ARGS="--color=auto" +# When non-default less options are used, add the -R option so that less outputs +# ANSI color escape codes "raw". +[ -n "$LESS" ] && QUILT_PAGER="less -R" + # (Add "-p ab" to QUILT_DIFF_ARGS and QUILT_REFRESH_ARGS to get # -p1 style diffs with a/file and b/file filenams in headers # instead of dir.orig/file and dir/file.) diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index b0ed135..be6228e 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -976,36 +976,31 @@ quilt_command() QUILT_COMMAND="" bash $BASH_OPTS -c "${SUBDIR:+cd $SUBDIR;} . $QUILT_DIR/$command" "quilt $command" "$@" } -# isatty FD -isatty() -{ - test -t $1 -} - -# setup_pager # Spawn pager process and redirect the rest of our output to it setup_pager() { - isatty 1 || return 0 - - # QUILT_PAGER = GIT_PAGER | PAGER | less - # NOTE: GIT_PAGER='' is significant - QUILT_PAGER=${GIT_PAGER-${PAGER-less}} + test -t 1 || return 0 - [ -z "$QUILT_PAGER" -o "$QUILT_PAGER" = "cat" ] && return 0 + # QUILT_PAGER = QUILT_PAGER | GIT_PAGER | PAGER | less + # NOTE: QUILT_PAGER='' is significant + QUILT_PAGER=${QUILT_PAGER-${GIT_PAGER-${PAGER-less}}} - # now spawn pager - export LESS="${LESS:-FRSX}" # as in pager.c:pager_preexec() + [ -z "$QUILT_PAGER" -o "$QUILT_PAGER" = "cat" ] && return 0 - _pager_fifo_dir="$(gen_tempfile -d)" - _pager_fifo="$_pager_fifo_dir/0" - mkfifo -m 600 "$_pager_fifo" + export LESS="${LESS:-FRSX}" - "$QUILT_PAGER" < "$_pager_fifo" & - exec > "$_pager_fifo" # dup2(pager_fifo.in, 1) + # NOTE: with "exec > >($pager)" there is no way to get the pid of the + # pager so we can't wait for it to complete. Otherwise we wouldn't + # need temporary files here. Alternatively, in recent versions of + # bash, a coprocess could be used instead. - # atexit(close(1); wait pager) - add_exit_handler "exec >&-; rm \"$_pager_fifo\"; rmdir \"$_pager_fifo_dir\"; wait" + local pager_fifo_dir pager_fifo + pager_fifo_dir="$(gen_tempfile -d)" + pager_fifo="$pager_fifo_dir/0" + mkfifo -m 600 "$pager_fifo" + "$QUILT_PAGER" < "$pager_fifo" & + exec > "$pager_fifo" + add_exit_handler "exec >&-; rm $pager_fifo; rmdir $pager_fifo_dir; wait" } # |