📄 fork.in
字号:
#! @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 functionsif [ "$(type -t patch_file_name)" != function ]then if ! [ -r $QUILT_DIR/scripts/patchfns ] then echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2 exit 1 fi . $QUILT_DIR/scripts/patchfnsfiusage(){ printf $"Usage: quilt fork [new_name]\n" if [ x$1 = x-h ] then printf $"Fork the topmost patch. Forking a patch means creating a verbatim copyof it under a new name, and use that new name instead of the originalone in the current series. This is useful when a patch has to bemodified, but the original version of it should be preserved, e.g.because it is used in another series, or for the history. A typicalsequence of commands would be: fork, edit, refresh.If new_name is missing, the name of the forked patch will be the currentpatch name, followed by \`-2'. If the patch name already ends in adash-and-number, the number is further incremented (e.g., patch.diff,patch-2.diff, patch-3.diff)." exit 0 else exit 1 fi}options=`getopt -o h -- "$@"`if [ $? -ne 0 ]then usagefieval set -- "$options"while truedo case "$1" in -h) usage -h ;; --) shift break ;; esacdoneif [ $# -gt 1 ]then usagefitop_patch=$(find_top_patch) || exit 1if [ $# -eq 1 ]then new_patch="$1"else base=$(echo "$top_patch" \ | sed -r -e 's:(\.gz|\.bz2)$::' -e 's:(\.diff?|\.patch)$::') num=$(echo "$base" | sed -nre 's:.*-([0-9]+)$:\1:'p) [ -n "$num" ] || num=1 new_patch="${base%-$num}-$((num+1))${top_patch#$base}"finew_patch=${new_patch#$QUILT_PATCHES/}if patch_in_series $new_patch || \ [ -d "$QUILT_PC/$new_patch" ] || \ [ -e "$(patch_file_name $new_patch)" ]then printf $"Patch %s exists already, please choose a new name\n" \ "$(print_patch $new_patch)" >&2 exit 1fiif ! rename_in_db "$top_patch" "$new_patch" || \ ! rename_in_series "$top_patch" "$new_patch" || \ ! mv "$QUILT_PC/$top_patch" "$QUILT_PC/$new_patch" || \ ( [ -e "$(patch_file_name $top_patch)" ] && \ ! cp -p "$(patch_file_name $top_patch)" \ "$(patch_file_name $new_patch)" )then printf $"Fork of patch %s to patch %s failed\n" \ "$(print_patch $top_patch)" \ "$(print_patch $new_patch)" >&2 exit 1fiprintf $"Fork of patch %s created as %s\n" \ "$(print_patch $top_patch)" \ "$(print_patch $new_patch)"### Local Variables:### mode: shell-script### End:# vim:filetype=sh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -