[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH 2/2] Delay sourcing patchfns until options have been
From: |
Jean Delvare |
Subject: |
[Quilt-dev] [PATCH 2/2] Delay sourcing patchfns until options have been processed |
Date: |
Wed, 19 May 2021 15:18:45 +0200 |
Commit 8b39a960afcf ("Consistently complain early if no series file
is found") unexpectedly broke commands like "quilt add -h", because
the check for a series file happens before the command line options
are processed. This, in turn, breaks the generation of the quilt
manual page, which relies on the output of each command when called
with option -h.
Reorder the code so that options are always processed first, and then
patchfns is sourced. That way, option "-h" will work again even if
not in a quilt working tree.
Fixes: 8b39a960afcf ("Consistently complain early if no series file is found")
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
quilt/add.in | 16 ++++-----
quilt/annotate.in | 17 +++++----
quilt/applied.in | 16 ++++-----
quilt/delete.in | 16 ++++-----
quilt/diff.in | 32 +++++++++---------
quilt/edit.in | 16 ++++-----
quilt/files.in | 23 ++++++++-----
quilt/fold.in | 16 ++++-----
quilt/fork.in | 16 ++++-----
quilt/graph.in | 16 ++++-----
quilt/grep.in | 16 ++++-----
quilt/header.in | 16 ++++-----
quilt/import.in | 19 +++++------
quilt/mail.in | 16 ++++-----
quilt/new.in | 16 ++++-----
quilt/next.in | 16 ++++-----
quilt/patches.in | 17 +++++----
quilt/pop.in | 16 ++++-----
quilt/previous.in | 16 ++++-----
quilt/push.in | 20 +++++------
quilt/refresh.in | 16 ++++-----
quilt/remove.in | 16 ++++-----
quilt/rename.in | 16 ++++-----
quilt/revert.in | 16 ++++-----
quilt/series.in | 16 ++++-----
quilt/setup.in | 38 +++++++++++-----------
quilt/snapshot.in | 16 ++++-----
quilt/top.in | 16 ++++-----
quilt/unapplied.in | 20 ++++++-----
quilt/upgrade.in | 16 ++++-----
test/help.test | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++
31 files changed, 365 insertions(+), 264 deletions(-)
--- quilt.orig/quilt/add.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/add.in 2021-05-19 14:44:05.017358026 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt add [-P patch] {file} ...\n"
@@ -85,6 +77,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
patch=$(find_applied_patch "$opt_patch") || exit 1
status=0
--- quilt.orig/quilt/annotate.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/annotate.in 2021-05-19 14:44:05.017358026 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt annotate [-P patch] {file}\n"
@@ -109,6 +101,15 @@ if [ $# -ne 1 ]
then
usage
fi
+
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
opt_file="$SUBDIR$1"
opt_patch=$(find_applied_patch "$opt_patch") || exit 1
--- quilt.orig/quilt/applied.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/applied.in 2021-05-19 14:44:05.017358026 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt applied [patch]\n"
@@ -54,6 +46,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
patch=$(find_applied_patch "$1") || exit 1
setup_pager
--- quilt.orig/quilt/delete.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/delete.in 2021-05-19 14:44:05.017358026 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt delete [-r] [--backup] [patch|-n]\n"
@@ -74,6 +66,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
if [ -n "$1" ]; then
patch=$(find_patch "$1") || exit 1
else
--- quilt.orig/quilt/diff.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/diff.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,16 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
-setup_colors
-
usage()
{
printf $"Usage: quilt diff [-p n|-p ab] [-u|-U num|-c|-C num]
[--combine patch|-z] [-R] [-P patch] [--snapshot] [--diff=utility]
[--no-timestamps] [--no-index] [--sort] [--color[=always|auto|never]] [file
...]\n"
@@ -156,12 +146,7 @@ do
shift 2 ;;
--combine)
opt_combine=1
- if [ "$2" = - ]
- then
- first_patch=-
- else
- first_patch=$(find_applied_patch "$2") || exit 1
- fi
+ first_patch=$2
shift 2 ;;
-R)
opt_reverse=1
@@ -212,6 +197,21 @@ do
esac
done
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
+setup_colors
+
+if [ -n "$first_patch" -a "$first_patch" != - ]
+then
+ first_patch=$(find_applied_patch "$first_patch") || exit 1
+fi
+
QUILT_DIFF_OPTS="$QUILT_DIFF_OPTS $opt_format"
opt_files=( $(for file in "$@"; do echo "$SUBDIR${file#./}" ; done) )
--- quilt.orig/quilt/edit.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/edit.in 2021-05-19 14:44:05.018358039 +0200
@@ -8,14 +8,6 @@
: ${EDITOR:=vi}
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt edit file ...\n"
@@ -56,6 +48,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
quilt_command add "$@"
status=$?
if [ $status -ne 0 -a $status -ne 2 ]
--- quilt.orig/quilt/files.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/files.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt files [-v] [-a] [-l] [--combine patch] [patch]\n"
@@ -69,7 +61,7 @@ do
then
:
else
- first_patch=$(find_patch_in_series "$2") || exit 1
+ first_patch=$2
fi
shift 2 ;;
--)
@@ -83,6 +75,19 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
+if [ -n "$first_patch" ]
+then
+ first_patch=$(find_patch_in_series "$first_patch") || exit 1
+fi
+
last_patch=$(find_patch_in_series "$1") || exit 1
if [ -n "$opt_all" -a -z "$first_patch" ]
--- quilt.orig/quilt/fold.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/fold.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt fold [-R] [-q] [-f] [-p strip-level]\n"
@@ -80,6 +72,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
: ${opt_strip_level:=1}
[ -n "$opt_quiet" ] && patch_args="$patch_args -s"
[ -z "$opt_force" -o -n "$opt_quiet" ] && patch_args="$patch_args -f"
--- quilt.orig/quilt/fork.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/fork.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt fork [new_name]\n"
@@ -63,6 +55,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
top_patch=$(find_top_patch) || exit 1
if [ $# -eq 1 ]
--- quilt.orig/quilt/graph.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/graph.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt graph [--all] [--reduce] [--lines[=num]]
[--edge-labels=files] [-T ps] [patch]\n"
@@ -106,6 +98,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
[ "$opt_format" = "ps" ] && check_external_tool dot graphviz -T
[ -n "$opt_reduce" ] && check_external_tool tred graphviz --reduce
--- quilt.orig/quilt/grep.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/grep.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt grep [-h|options] {pattern}\n"
@@ -114,6 +106,14 @@ fi
# may pass a single filename to grep and cause it to omit the file name.
[ -z "$opt_h" ] && opt_H=-H
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
find "${myargs[@]:-.}" \( \
-path "./$QUILT_PATCHES/*" -o \
-path "./$QUILT_PC/*" \) -prune -o \
--- quilt.orig/quilt/header.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/header.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
: ${EDITOR:=vi}
usage()
@@ -114,6 +106,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
patch=$(find_patch_in_series "$1") || exit 1
patch_file=$(patch_file_name $patch)
--- quilt.orig/quilt/import.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/import.in 2021-05-19 14:44:05.018358039 +0200
@@ -9,14 +9,6 @@
# One of the few commands which does not need a series file
skip_series_check=1
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt import [-p num] [-R] [-P patch] [-f] [-d {o|a|n}]
patchfile ...\n"
@@ -134,7 +126,7 @@ while true
do
case "$1" in
-P)
- opt_patch=${2#$QUILT_PATCHES/}
+ opt_patch=$2
shift 2 ;;
-p)
opt_strip=$2
@@ -165,6 +157,15 @@ then
exit 1
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
+[ -n "$opt_patch"] && opt_patch=${opt_patch#$QUILT_PATCHES/}
[ -n "$opt_strip" ] && patch_args="-p$opt_strip"
if [ -n "$opt_reverse" ]
then
--- quilt.orig/quilt/mail.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/mail.in 2021-05-19 14:44:05.018358039 +0200
@@ -8,14 +8,6 @@
: ${EDITOR:=vi}
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt mail {--mbox file|--send} [-m text] [-M file]
[--prefix prefix] [--sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...]
[--subject ...] [--reply-to message] [--charset ...] [--signature file]
[first_patch [last_patch]]\n"
@@ -270,6 +262,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
if [ $# -ge 1 ]
then
if [ "$1" = - ]
--- quilt.orig/quilt/new.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/new.in 2021-05-19 14:44:05.018358039 +0200
@@ -9,14 +9,6 @@
# One of the few commands which does not need a series file
skip_series_check=1
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt new [-p n|-p ab] {patchname}\n"
@@ -84,6 +76,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
if [ "$QUILT_PATCHES" = "$QUILT_PC" ]
then
printf $"QUILT_PATCHES(%s) must differ from QUILT_PC(%s)\n"
"$QUILT_PATCHES" "$QUILT_PC"
--- quilt.orig/quilt/next.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/next.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt next [patch]\n"
@@ -54,6 +46,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
next=$(find_unapplied_patch "$1") || exit
if [ -n "$next" ]
--- quilt.orig/quilt/patches.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/patches.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
declare -a opt_files=()
usage()
@@ -124,6 +116,15 @@ if [ $# -lt 1 ]
then
usage
fi
+
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
while [ $# -ge 1 ]
do
opt_files[${#opt_files[@]}]="$SUBDIR$1"
--- quilt.orig/quilt/pop.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/pop.in 2021-05-19 14:44:05.018358039 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt pop [-afRqv] [--refresh] [num|patch]\n"
@@ -208,6 +200,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
if [ -n "$opt_force" -a -n "$opt_refresh" ]
then
printf $"Options %s and %s are mutually exclusive\n" "-f" "--refresh"
--- quilt.orig/quilt/previous.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/previous.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt previous [patch]\n"
@@ -54,6 +46,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
patch=$(find_patch_in_series "$1") || exit 1
previous=$(applied_before "$patch" | tail -n 1)
--- quilt.orig/quilt/push.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/push.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,16 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
-setup_colors
-
usage()
{
printf $"Usage: quilt push [-afqvm] [--fuzz=N] [--merge[=merge|diff3]]
[--leave-rejects] [--color[=always|auto|never]] [--refresh] [num|patch]\n"
@@ -368,6 +358,16 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
+setup_colors
+
if [ -n "$opt_force" -a -n "$opt_refresh" ]
then
printf $"Options %s and %s are mutually exclusive\n" "-f" "--refresh"
--- quilt.orig/quilt/refresh.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/refresh.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt refresh [-p n|-p ab] [-u|-U num|-c|-C num]
[-z[new_name]] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort]
[--backup] [--strip-trailing-whitespace] [patch]\n"
@@ -146,6 +138,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
QUILT_DIFF_OPTS="$QUILT_DIFF_OPTS $opt_format"
patch=$(find_applied_patch "$1") || exit 1
--- quilt.orig/quilt/remove.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/remove.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt remove [-P patch] {file} ...\n"
@@ -60,6 +52,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
patch=$(find_applied_patch "$opt_patch") || exit 1
status=0
--- quilt.orig/quilt/rename.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/rename.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt rename [-P patch] new_name\n"
@@ -70,6 +62,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
patch=$(find_patch_in_series "$opt_patch") || exit 1
new_patch=${1#$QUILT_PATCHES/}
--- quilt.orig/quilt/revert.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/revert.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt revert [-P patch] {file} ...\n"
@@ -62,6 +54,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
patch=$(find_applied_patch "$opt_patch") || exit 1
status=0
--- quilt.orig/quilt/series.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/series.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt series [--color[=always|auto|never]] [-v]\n"
@@ -85,6 +77,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
setup_pager
if [ -n "$opt_verbose$opt_color" ]
--- quilt.orig/quilt/setup.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/setup.in 2021-05-19 14:44:05.019358051 +0200
@@ -10,25 +10,6 @@
skip_version_check=1
skip_series_check=1
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
-if [ -n "$SUBDIR" ]
-then
- # Damn, found an enclosing quilt directory; don't follow its settings
- cd $SUBDIR
- unset SUBDIR
- unset QUILT_PC QUILT_PATCHES QUILT_SERIES
- : ${QUILT_PC:=.pc}
- : ${QUILT_PATCHES:=patches}
- : ${QUILT_SERIES:=series}
-fi
-
check_for_existing_directories()
{
local tag dir last_dir arg status=0
@@ -354,6 +335,25 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
+if [ -n "$SUBDIR" ]
+then
+ # Damn, found an enclosing quilt directory; don't follow its settings
+ cd $SUBDIR
+ unset SUBDIR
+ unset QUILT_PC QUILT_PATCHES QUILT_SERIES
+ : ${QUILT_PC:=.pc}
+ : ${QUILT_PATCHES:=patches}
+ : ${QUILT_SERIES:=series}
+fi
+
tmpfile=$(gen_tempfile)
add_exit_handler "rm -f $tmpfile"
--- quilt.orig/quilt/snapshot.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/snapshot.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt snapshot [-d]\n"
@@ -61,6 +53,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
snap_subdir=.snap
# Clean up from previous snapshot
--- quilt.orig/quilt/top.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/top.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt top\n"
@@ -54,6 +46,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
top=$(find_top_patch) || exit 2
print_patch $top
### Local Variables:
--- quilt.orig/quilt/unapplied.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/unapplied.in 2021-05-19 14:44:05.019358051 +0200
@@ -6,14 +6,6 @@
#
# See the COPYING and AUTHORS files for more details.
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt unapplied [patch]\n"
@@ -52,7 +44,17 @@ done
if [ $# -gt 1 ]
then
usage
-elif [ $# -eq 1 ]
+fi
+
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
+if [ $# -eq 1 ]
then
start=$(find_patch_in_series "$1") || exit 1
patch=$(patch_after "$start")
--- quilt.orig/quilt/upgrade.in 2021-05-19 14:43:56.153246419 +0200
+++ quilt/quilt/upgrade.in 2021-05-19 14:44:05.019358051 +0200
@@ -10,14 +10,6 @@
skip_version_check=1
skip_series_check=1
-# Read in library functions
-if ! [ -r $QUILT_DIR/scripts/patchfns ]
-then
- echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
- exit 1
-fi
-. $QUILT_DIR/scripts/patchfns
-
usage()
{
printf $"Usage: quilt upgrade\n"
@@ -60,6 +52,14 @@ then
usage
fi
+# Read in library functions
+if ! [ -r $QUILT_DIR/scripts/patchfns ]
+then
+ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
+ exit 1
+fi
+. $QUILT_DIR/scripts/patchfns
+
if version_check
then
printf $"The quilt meta-data in %s are already in the version %s
format; nothing to do\n" "$QUILT_PC/" "$DB_VERSION"
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ quilt/test/help.test 2021-05-19 14:48:21.001581106 +0200
@@ -0,0 +1,91 @@
+# We simulate a working tree root so that quilt does not attempt to find one
+# in a parent directory, as this would invalidate this test
+$ mkdir $QUILT_PC
+$ echo 2 > $QUILT_PC/.version
+
+$ quilt add -h | grep -c '^Usage:'
+> 1
+
+$ quilt annotate -h | grep -c '^Usage:'
+> 1
+
+$ quilt applied -h | grep -c '^Usage:'
+> 1
+
+$ quilt delete -h | grep -c '^Usage:'
+> 1
+
+$ quilt diff -h | grep -c '^Usage:'
+> 1
+
+$ quilt edit -h | grep -c '^Usage:'
+> 1
+
+$ quilt files -h | grep -c '^Usage:'
+> 1
+
+$ quilt fold -h | grep -c '^Usage:'
+> 1
+
+$ quilt fork -h | grep -c '^Usage:'
+> 1
+
+$ quilt graph -h | grep -c '^Usage:'
+> 1
+
+$ quilt grep -h | grep -c '^Usage:'
+> 1
+
+$ quilt header -h | grep -c '^Usage:'
+> 1
+
+$ quilt import -h | grep -c '^Usage:'
+> 1
+
+$ quilt mail -h | grep -c '^Usage:'
+> 1
+
+$ quilt new -h | grep -c '^Usage:'
+> 1
+
+$ quilt next -h | grep -c '^Usage:'
+> 1
+
+$ quilt patches -h | grep -c '^Usage:'
+> 1
+
+$ quilt pop -h | grep -c '^Usage:'
+> 1
+
+$ quilt previous -h | grep -c '^Usage:'
+> 1
+
+$ quilt push -h | grep -c '^Usage:'
+> 1
+
+$ quilt refresh -h | grep -c '^Usage:'
+> 1
+
+$ quilt remove -h | grep -c '^Usage:'
+> 1
+
+$ quilt rename -h | grep -c '^Usage:'
+> 1
+
+$ quilt series -h | grep -c '^Usage:'
+> 1
+
+$ quilt setup -h | grep -c '^Usage:'
+> 1
+
+$ quilt snapshot -h | grep -c '^Usage:'
+> 1
+
+$ quilt top -h | grep -c '^Usage:'
+> 1
+
+$ quilt unapplied -h | grep -c '^Usage:'
+> 1
+
+$ quilt upgrade -h | grep -c '^Usage:'
+> 1
--
Jean Delvare
SUSE L3 Support