From ad84b7da12438b693d9ab6872b35e780a2190e94 Mon Sep 17 00:00:00 2001 From: wangdi Date: Mon, 20 Oct 2003 08:40:13 +0000 Subject: add fork.in gendiff.in for quilt fork and quilt gendiff command --- quilt/fork.in | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ quilt/gendiff.in | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+) create mode 100644 quilt/fork.in create mode 100755 quilt/gendiff.in diff --git a/quilt/fork.in b/quilt/fork.in new file mode 100644 index 0000000..822036c --- /dev/null +++ b/quilt/fork.in @@ -0,0 +1,98 @@ +#! @BASH@ + +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# See the COPYING and AUTHORS files for more details. + +# Read in library functions +if [ "$(type -t patch_file_name)" != function ] +then + if ! [ -r @SCRIPTS@/patchfns ] + then + echo "Cannot read library @SCRIPTS@/patchfns" >&2 + exit 1 + fi + . @SCRIPTS@/patchfns +fi + +usage() +{ + echo $"Usage: quilt fork {new_patchname}" + if [ x$1 = x-h ] + then + echo $" + Fork the next patch in the series +" + exit 0 + else + exit 1 + fi +} + +options=`getopt -o h -- "$@"` + +if [ $? -ne 0 ] +then + usage +fi + +eval set -- "$options" + +while true +do + case "$1" in + -h) + usage -h ;; + --) + shift + break ;; + esac +done + +if [ $# -ne 1 ] +then + usage +fi + +patch_file=$(echo $1 | @SED@ -e 's/^'"$(quote_bre $P)"'patches\///') +patch=$(stripit $patch_file) + +if patch_in_series $patch +then + echo $"Patch $patch exists already, please change a new_name" + exit 1 +fi + +mkdir -p $(dirname $(pc_file_name $patch)) +rm -f $(pc_file_name $patch) + +next_patch=$(patches_after $(top_patch) | head -n 1) +#copy the original patch to the cloned patch + +next_patch_file=$(patch_file_name $next_patch) +next_pc=$(pc_file_name $next_patch) + +cp -f ${next_patch_file} patches/${patch_file}.patch + +#remove the original patch +if [ -z next_patch ] +then + echo $"patch ended at $(top_patch)" + exit 1 +else + remove_from_series $next_patch +fi + +#add the cloned patch to series +if ! insert_in_series ${patch_file}.patch +then + echo $"Failed to fork patch $patch" + exit 1 +fi +echo $"cloned $next_patch to $patch_file" +### Local Variables: +### mode: shell-script +### End: +# vim:filetype=sh diff --git a/quilt/gendiff.in b/quilt/gendiff.in new file mode 100755 index 0000000..11791ed --- /dev/null +++ b/quilt/gendiff.in @@ -0,0 +1,93 @@ +#! @BASH@ +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# See the COPYING and AUTHORS files for more details. +# Read in library functions +if [ "$(type -t patch_file_name)" != function ] +then + if ! [ -r @SCRIPTS@/patchfns ] + then + echo "Cannot read library @SCRIPTS@/patchfns" >&2 + exit 1 + fi + . @SCRIPTS@/patchfns +fi + +usage() +{ + local redirect + if [ x$1 != x-h ] + then + redirect='>&2' + fi + echo $"Usage: quilt gendiff" $redirect + + if [ x$1 = x-h ] + then + echo $" +Produces a diff between + - the files patched with .quiltsave. (old) + - the files patched with +" + exit 0 + else + exit 1 + fi +} +die () +{ + local status=$1 + [ -n "$workdir" ] && rm -rf $workdir + exit $status +} + +options=`getopt -o h -- "$@"` + +if [ $? -ne 0 ] +then + usage +fi +opt_Overwrite=0 +opt_Keep=0 +eval set -- "$options" + +while true +do + case "$1" in + -h) + usage -h ;; + --) + shift + break ;; + esac +done + +top=$(top_patch) +save_patch_name=$(save_patch_name ${top}) +if [ ! -e ".pc/$save_patch_name" ]; then + echo "Does not exist the $save_patch_name in your .pc" + echo "please refresh patches first" + exit 1 +fi + +for file in $(files_in_patch $save_patch_name) +do + if [ ! -e $file ]; then + echo "$file has been deleted" + else + base_dir=$(pwd) + ln -s $base_dir/.pc/$save_patch_name/$file ${file}~old + diff -Nur ${file}~old $file + rm -rf ${file}~old + fi +done + +trap "die 1" SIGTERM + +die 0 +### Local Variables: +### mode: shell-script +### End: +# vim:filetype=sh -- cgit