From c68dbc731f073e0385d2f235f767dbda713b0806 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Tue, 21 Oct 2003 23:44:22 +0000 Subject: - `Quilt fork' should better fork the next patch instead of the topmost one. Also fix a bug in updating the series file when forking. The rename_in_db() function is no longer needed. --- quilt.changes | 7 +++++++ quilt/fork.in | 28 ++++++++++++---------------- scripts/patchfns.in | 23 +---------------------- 3 files changed, 20 insertions(+), 38 deletions(-) diff --git a/quilt.changes b/quilt.changes index 2cc8a90..7a8614c 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Oct 22 01:44:04 CEST 2003 - agruen@suse.de + +- `Quilt fork' should better fork the next patch instead of the + topmost one. Also fix a bug in updating the series file when + forking. The rename_in_db() function is no longer needed. + ------------------------------------------------------------------- Tue Oct 21 20:44:00 CEST 2003 - agruen@suse.de diff --git a/quilt/fork.in b/quilt/fork.in index 1eeb51d..5c664fb 100644 --- a/quilt/fork.in +++ b/quilt/fork.in @@ -23,8 +23,8 @@ usage() if [ x$1 = x-h ] then echo $" -Fork the topmost patch. If new_name is missing, the name of the -forked patch will be the current patch name, followed by \"-2\". If the +Fork the next patch. If new_name is missing, the name of the +forked patch will be the current patch name, followed by \"-2\". If the patch name already ends in a dash-and-number, the number is further incremented (e.g., patch.diff, patch-2.diff). " @@ -59,26 +59,26 @@ then usage fi -top="$(top_patch)" -if [ -z "$top" ] +next="$(patches_after $(top_patch) | head -n 1)" +if [ -z "$next" ] then - echo $"No patches applied" >&2 + echo $"All patches applied" >&2 exit 1 fi -top_file_name="$(patch_file_name $top)" +next_file_name="$(patch_file_name $next)" if [ $# -eq 1 ] then patch_file="$1" else - set -- $(echo "$top" \ + set -- $(echo "$next" \ | @SED@ -e 's: :\ :g' -e 's:-\([0-9]\+\)$: \1:') if [ $# -eq 1 ]; then patch_file="$1-2" else patch_file="$1-$[$2+1]" fi - ext="$(echo $top_file_name \ + ext="$(echo $next_file_name \ | @SED@ -e '\:\.\(diff\?\|patch\)\(\.gz\|\.bz2\|\)$:!d' \ -e 's:.*\(\.\(diff\?\|patch\)\(\.gz\|\.bz2\|\)\)$:\1:')" patch_file="$patch_file$ext" @@ -86,26 +86,22 @@ fi patch_file=$(echo $patch_file | @SED@ -e 's/^'"$(quote_bre $P)"'patches\///') patch=$(stripit $patch_file) -pc_dir=".pc/$patch" if patch_in_series $patch || \ - [ -d "$pc_dir" ] || \ [ -e "patches/$patch_file" ] then echo $"Patch $patch exists already, please choose a new name" exit 1 fi -if ! rename_in_db "$top" "$patch" || \ - ! rename_in_series "$top" "$patch_file" || \ - ! mv ".pc/$top" $pc_dir || \ - ! cp -p "$top_file_name" "$(patch_file_name $patch)" +if ! rename_in_series "$next" "$patch_file" || \ + ! cp -p "$next_file_name" "$(patch_file_name $patch)" then - echo $"Fork of $top_file_name to $patch_file failed" >&2 + echo $"Fork of $next_file_name to $patch_file failed" >&2 exit 1 fi -echo $"Fork of $top_file_name created as $(patch_file_name $patch)" +echo $"Fork of $next_file_name created as $(patch_file_name $patch)" ### Local Variables: ### mode: shell-script diff --git a/scripts/patchfns.in b/scripts/patchfns.in index 1aab136..0de9c85 100644 --- a/scripts/patchfns.in +++ b/scripts/patchfns.in @@ -226,8 +226,8 @@ rename_in_series() /^'"$(quote_re $from)"'(|\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)/ \ { sub(/'"$(quote_re $from)(|\.patch|\.diff?)(|\.gz|\.bz2)"'/, "'"${to//\"/\\\"}"'") - print good=1 } + { print } END { exit(! good) } ' $SERIES > $tmpfile if [ $? -eq 0 ] @@ -487,27 +487,6 @@ remove_from_db() fi } -rename_in_db() -{ - local from=$1 to=$2 - local tmpfile - tmpfile=$(gen_tempfile) || return 1 - /usr/bin/gawk ' - /^'"$(quote_re $from)"'$/ \ - { sub(/'"$(quote_re $from)"'/, "'"${to//\"/\\\"}"'") - print - good=1 } - END { exit(! good) } - ' $DB > $tmpfile - if [ $? -eq 0 ] - then - mv -f $tmpfile $DB - else - rm -f $tmpfile - return 1 - fi -} - stripit() { if [ -n "$1" ] -- cgit