blob: 1bf90774bf784b2a45d60c718fa66bab7d980dd6 (
plain)
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
|
#!/bin/sh
# git-post-review: post a review to the ReviewBoard based on a local git
# diff. The SVN information is based on the 'git-svn-id' data from
# the git HEAD.
# Based on 'git-svn-diff by Leif Hedstrom from:
# http://www.mail-archive.com/dev@trafficserver.apache.org/msg00864.html
set -e
svn_url=`git show HEAD | awk '/git-svn-id:/ {print $2}' | head -n1`
line='==================================================================='
REV=`echo $svn_url | cut -d'@' -f2 | cut -d' ' -f1`
BRANCH=`echo $svn_url | sed -e 's|@.*||' -e 's|.*/svn/[^/]*/|/|'`
tempfile=`mktemp post-review-XXXXXX`
#git diff --no-prefix $(git rev-list --date-order --max-count=1 $TRACKING_BRANCH) $* |
git diff --no-prefix |
sed -e "s|^\(+++ \)\(.*\)|\1$BRANCH/\2 (working copy)|" \
-e "s|^\(--- \)\(.*\)|\1$BRANCH/\2 (revision $REV)|" \
-e "s/^diff --git [^[:space:]]*/Index:/" \
-e "s/^index.*/$line/" \
> "$tempfile"
REPO_URL=`echo $svn_url | cut -d/ -f1-5`
post-review --repository-url=$REPO_URL --diff-filename="$tempfile" "$@"
rm "$tempfile"
|