Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: patchconv/rapply.sh

Issue 29524903: Noissue - Add helper script to import changes from Rietveld reviews (Closed)
Left Patch Set: Make rapply.sh commit the changes and work without installing patchconv.py Created Aug. 25, 2017, 3:47 p.m.
Right Patch Set: Revert the committing logic and simplify patchconv discovery Created Aug. 25, 2017, 6:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « patchconv/README.md ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # This file is part of Adblock Plus <https://adblockplus.org/>, 3 # This file is part of Adblock Plus <https://adblockplus.org/>,
4 # Copyright (C) 2006-present eyeo GmbH 4 # Copyright (C) 2006-present eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details. 13 # GNU General Public License for more details.
14 # 14 #
15 # You should have received a copy of the GNU General Public License 15 # You should have received a copy of the GNU General Public License
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
17 17
18 set -eu 18 set -eu
19 19
20 if [ $# -lt 1 ]; then 20 if [ $# -lt 1 ]; then
21 echo "usage: rapply.sh PATCH" 21 echo "usage: rapply.sh PATCH"
22 exit 1 22 exit 1
23 fi 23 fi
24 24
25 MESSAGE="rapply.sh $1"
26 if git st >/dev/null 2>&1; then 25 if git st >/dev/null 2>&1; then
27 alias IMPORT="git apply --index && git commit -m '$MESSAGE'" 26 IMPORT="git apply"
Sebastian Noack 2017/08/25 16:40:38 As per the discussion on IRC, sorry, for some reas
Vasily Kuznetsov 2017/08/25 18:52:14 Done.
28 elif hg st >/dev/null 2>&1; then 27 elif hg st >/dev/null 2>&1; then
29 alias IMPORT="hg import -m '$MESSAGE' -" 28 IMPORT="hg import --no-commit -"
30 else 29 else
31 echo "No repository found in `pwd`" 30 echo "No repository found in `pwd`"
32 exit 2 31 exit 2
33 fi 32 fi
34 33
35 BASEDIR=$(dirname $0) 34 BASEDIR=$(dirname "$0")
36 if [ -f "$BASEDIR/patchconv.py" ]; then 35 if [ -f "$BASEDIR/patchconv.py" ]; then
37 alias PATCHCONV="python $BASEDIR/patchconv.py" 36 alias patchconv="$BASEDIR/patchconv.py"
Sebastian Noack 2017/08/25 16:40:38 patchconv.py is executable. Specifying the interpr
Vasily Kuznetsov 2017/08/25 18:52:14 Done.
38 elif which -s patchconv; then
39 alias PATCHCONV=patchconv
40 else
41 echo "Can't find patchconv in the PATH or in $BASEDIR."
Sebastian Noack 2017/08/25 16:40:38 This error message and the `which ...` check above
Vasily Kuznetsov 2017/08/25 18:52:14 Done.
42 exit 4
43 fi 37 fi
44 38
45 if [ -f "$1" ]; then 39 if [ -f "$1" ]; then
46 PATCHCONV < "$1" | IMPORT 40 patchconv < "$1" | $IMPORT
47 else 41 else
48 curl "$1" | PATCHCONV | IMPORT 42 curl "$1" | patchconv | $IMPORT
49 fi 43 fi
LEFTRIGHT

Powered by Google App Engine
This is Rietveld