-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatch_zp
executable file
·41 lines (27 loc) · 946 Bytes
/
batch_zp
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
#!/usr/bin/env bash
# Get revisions by inspecting svn log --stop-on-copy http://path/to/zenpack/in/4.2.x
# RUN LIKE: batch_zp ZenPacks.zenoss.EnterpriseCollector start_rev end_rev jira_issue
VERSION=zenoss-4.2.x
ZENPACK=$1
DEST_DIR=/tmp/zp_diffs/$ZENPACK/
mkdir -p $DEST_DIR
DIFF_FILE=$DEST_DIR/$2_$3_$4.diff
svn diff -r $2:$3 http://[email protected]/svnint/branches/$VERSION/zenpacks/$ZENPACK > $DIFF_FILE
patch --dry-run -p0 < $DIFF_FILE
echo "Patch it?"
#Kick this off while we wait for user feedback.
COMMIT_MSG=$(jira.sh --action getFieldValue --issue "$4" --field "summary" | head -n2 | tail -n1)
echo "Using commit: " $COMMIT_MSG
read doit
if [ -z COMMIT_MSG ]; then
COMMIT_MSG=$doit
fi
patch -p0 < $DIFF_FILE
git add -u
git st
OUR_MSG=$(printf "%s: (r%s-r%s) %s" $4 $2 $3 "$COMMIT_MSG")
echo "Commit with message:"
echo $(tput setaf 2)$OUR_MSG$(tput sgr0)
echo "Commit?"
read really_doit
git commit -m "$OUR_MSG"