File: merge_utils.sh

package info (click to toggle)
cvsps 2.0rc1-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 316 kB
  • ctags: 389
  • sloc: ansic: 4,477; makefile: 69; sh: 26
file content (50 lines) | stat: -rw-r--r-- 1,214 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
##################################################
# utility bash functions to help with merging    #
##################################################
# copyright 2003 David Mansfield                 #
##################################################
# usage:  . merge_utils.sh                       #
##################################################

#
# show patchset
#
function sps() { 
less $PATCHSETDIR/$1.patch
}

#
# test apply patchset
#
function tps() { 
cat $PATCHSETDIR/$1.patch | patch -p1 --dry-run
}

#
# apply patchset
#
function aps() { 
cat $PATCHSETDIR/$1.patch | patch -p1
}

#
# commit changes as merge of patchset.
#
function cps() {
LOGMSG=`cat $PATCHSETDIR/$1.patch | perl -e '$line = 0; while(<>) {
    if ($line == 1) { if (/PatchSet ([[:digit:]]*)/) { $ps = $1; }}
    if ($line == 2) { if (/Date: (.*)/) { $dt = $1; }}
    if ($line == 4) { if (/Branch: (.*)/) { $br = $1; }}
    if ($line == 7) { $lg = $_; chop($lg) }
    $line++;
}
print "Merge ps:$ps date:$dt branch:$br log:$lg\n";
'`
echo Committing with log message "'$LOGMSG'"
if [ "$2" != "-n" ]
then 
    cvs commit -m"$LOGMSG"
fi
}

echo "Don't forget to set \$PATCHSETDIR to the directory where you patchset diffs are"