cvsmerge

来自「cygwin, 著名的在win32下模拟unix操作系统的东东」· 代码 · 共 78 行

TXT
78
字号
#!/bin/sh -eif [ $# -ne 1 ]; then   echo "Usage: $0 merge-from"   echo "    where merge-from is the branch you want to merge changes from"   exit 1fiif [ ! -f CVS/Root ] || [ ! -f CVS/Repository ]; then    echo "ERROR: The script must be run from a CVS working directory"    exit 1fiif [ -f CVS/Tag ]; then    localtag=`cat CVS/Tag|cut -c2-`else    localtag=HEADfirootdir=`cat CVS/Root|sed -e 's/.*://'`module=`cat CVS/Repository|sed -e "s#^$rootdir##"`mergefrom="$1"mergetag="Z-${localtag}_merge_${mergefrom}"newtag="Z-${localtag}_merge-new_${mergefrom}"oldtag="Z-${localtag}_merge-old_${mergefrom}"ecvs() {    echo cvs $* >&2    cvs "$@"}o () {    echo "# $*..."}o Check if there is any pending changes in the repositorydiffl=`ecvs -z9 -q rdiff -kk -r ${mergetag} -r ${mergefrom} ${module} | wc -l`if [ $diffl -eq 0 ]; then    o No pending changes    echo No pending changes > merge.log    exit 0fio Make sure there is no pending changes in the working directorydiffl=`ecvs -z9 -q diff -kk | grep -v '^\?' | wc -l`if [ $diffl -ne 0 ]; then    echo "ERROR: You must first commit any pending changes"    exit 1fio Make sure the working directory is up to dateecvs -z9 -q update -kk -d -P 2>&1 | tee merge.logo Set a temporary tag at the new version we are merging towardsecvs -z9 -q rtag -F -r ${mergefrom} ${newtag} ${module}o Merge changes into the working directoryecvs -z9 -q update -kk -d -P -j ${mergetag} -j ${newtag} 2>&1 | tee -a merge.logo Prune out RCS keywordsfiles=`find . -type f -print | xargs grep -l '\$Id:' || true`if [ -n "$files" ]; then    perl -i.orig -p -e 's/\$(Id|Revision):[^\$]*\$/\$$1\$/' $filesfio Checking for conflictsif grep conflict merge.log; then    echo "WARNING: CONFLICTS!"    echo "Please correct the conflicts (see merge.log) and then exit from"    echo "this shell to have the changes committed"    $SHELL || truefio Commit the changesecvs -z9 -q commit -m "Merged changes from ${mergefrom}"o Move our baseline to the new version"(s)"ecvs -z9 -q rtag -F -r ${newtag} ${mergetag} ${module}echo "Done."

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?