Use regex.[ch] from msysGit's /git
[cvsps/4msysgit.git] / merge_utils.sh
blob137cde6a86d35b87ad81f3705bde2dd956c420b7
1 ##################################################
2 # utility bash functions to help with merging #
3 ##################################################
4 # copyright 2003 David Mansfield #
5 ##################################################
6 # usage: . merge_utils.sh #
7 ##################################################
10 # show patchset
12 function sps() {
13 less $PATCHSETDIR/$1.patch
17 # test apply patchset
19 function tps() {
20 cat $PATCHSETDIR/$1.patch | patch -p1 --dry-run
24 # apply patchset
26 function aps() {
27 cat $PATCHSETDIR/$1.patch | patch -p1
31 # commit changes as merge of patchset.
33 function cps() {
34 LOGMSG=`cat $PATCHSETDIR/$1.patch | perl -e '$line = 0; while(<>) {
35 if ($line == 1) { if (/PatchSet ([[:digit:]]*)/) { $ps = $1; }}
36 if ($line == 2) { if (/Date: (.*)/) { $dt = $1; }}
37 if ($line == 4) { if (/Branch: (.*)/) { $br = $1; }}
38 if ($line == 7) { $lg = $_; chop($lg) }
39 $line++;
41 print "Merge ps:$ps date:$dt branch:$br log:$lg\n";
43 echo Committing with log message "'$LOGMSG'"
44 if [ "$2" != "-n" ]
45 then
46 cvs commit -m"$LOGMSG"
50 echo "Don't forget to set \$PATCHSETDIR to the directory where you patchset diffs are"