-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathic
executable file
·78 lines (55 loc) · 1.73 KB
/
ic
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
#
# Usage: ic 36974 (changeset number referencing a patch file.)
#
# make sure you export RPS_PATCHES, RPS_REPO dirs.
# make sure you export RPS_AS_OF revision.
#
set -u
echo "RPS Patches: " $RPS_PATCHES
echo "RPS Repository: " $RPS_REPO
echo "RPS Revision: " $RPS_AS_OF
echo
pushd $RPS_REPO
CHANGESET=$1
PATCH_FILE=$(ls $RPS_PATCHES | grep $CHANGESET)
echo "============================================="
echo "SVN Info for changeset: $CHANGESET"
echo "============================================="
echo "==> Commit message for last change to file:"
SVN_LOG=$(svn log -vl1 $RPS_PATCHES/$PATCH_FILE)
echo $SVN_LOG
echo "==> Commit message for changeset named in file name:"
CHANGESET_LOG=$(svn log -c $CHANGESET http://[email protected]/svnint)
echo $CHANGESET_LOG
# This does not handle the following well at all:
# Fixes ZEN-123, backport ZEN-59 to 4.1.x branch
REF_TRY=$(echo $SVN_LOG | tr "[a-z]" "[A-Z]" | sed -ne "s/.*\(ZEN-[0-9]*\).*/\1/gp")
if [ -x $REF_TRY ]; then
# Get our ref
echo "NO ISSUE FOUND. YOU PROBABLY NEED TO CREATE ONE."
echo -n "Issue number? "
read REF
REF=$(echo "ZEN-$REF" | tr '[a-z]' '[A-Z]')
else
REF=$REF_TRY
fi
echo "Using REF: " $REF
# Get the commit message
echo -n "Need commit message: "
read COMMIT
OUR_MSG=$(printf "%s: (changeset_%s.diff) %s (as of RPS revision %s)" $REF $CHANGESET "$COMMIT" $RPS_AS_OF)
echo $OUR_MSG
echo "Applying patch: " $PATCH_FILE
pushd $RPS_REPO/src/core
patch -p0 < $RPS_PATCHES/$PATCH_FILE
popd
git status -s
echo "Using commit message: "
# 1 = red, 2 = green
echo $(tput setaf 2)$OUR_MSG$(tput sgr0)
# If you want to bail, better ctrl-c!
echo -n "Commit? (enter means yes)"
read DOIT
git add -u
git commit -m "$OUR_MSG"