summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2003-10-29 16:20:32 +0000
committerAndreas Gruenbacher <agruen@suse.de>2003-10-29 16:20:32 +0000
commit4439b9c03e23f51e6d28eadac44089fba0b28856 (patch)
treead6bc7d9f27a6942e78176795b1d3e79ba82a867 /scripts
parent0649767d2c7f6cb6b5791564b6623c132fd674fd (diff)
downloadquilt-4439b9c03e23f51e6d28eadac44089fba0b28856.tar.gz
- If a patch does not apply cleanly and `quilt push' removes
rejects files it GNU patch left behind, change the output from ``saving rejects to file x.rej'' to ``rejects in file x''.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/apatch.in22
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/apatch.in b/scripts/apatch.in
index 69f327f..511f878 100755
--- a/scripts/apatch.in
+++ b/scripts/apatch.in
@@ -47,7 +47,7 @@ interrupt()
apply_patch()
{
local patch=$1
- local patch_file=$(patch_file_name $patch)
+ local patch_file=$(patch_file_name $patch) output
if ! [ -s $patch_file ]
then
@@ -57,18 +57,31 @@ apply_patch()
if [ "x${patch_file:(-3)}" = "x.gz" ]
then
+ output="$(
gzip -cd $patch_file \
| @PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \
- -E $silent $force_apply
+ -E $silent $force_apply 2>&1 )"
elif [ "x${patch_file:(-4)}" = "x.bz2" ]
then
+ output="$(
bzip2 -cd $patch_file \
| @PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \
- -E $silent $force_apply
+ -E $silent $force_apply 2>&1 )"
else
+ output="$(
@PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \
- -E $silent -i $patch_file $force_apply
+ -E $silent -i $patch_file $force_apply 2>&1 )"
fi
+ status=${PIPESTATUS[0]}
+ if [ $status -ne 0 -a -z "$opt_leave_rejects" ]
+ then
+ # The reject files are removed in rollback_patch.
+ echo "$output" \
+ | sed -e 's/-- saving rejects to file \(.\+\)\.rej/-- rejects in file \1/'
+ else
+ echo "$output"
+ fi
+ return $status
}
apatch()
@@ -152,6 +165,7 @@ fi
[ -n "$opt_quiet" ] && silent=-s
[ -z "$opt_verbose" ] && silent_unless_verbose=-s
[ -z "$opt_interactive" ] && force_apply=-f
+[ -n "$opt_force" ] && opt_leave_rejects=1
patch=$(stripit $1)