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

Unified Diff: patchconv/rapply.sh

Issue 29524903: Noissue - Add helper script to import changes from Rietveld reviews (Closed)
Patch Set: Make rapply.sh commit the changes and work without installing patchconv.py Created Aug. 25, 2017, 3:47 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « patchconv/README.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patchconv/rapply.sh
===================================================================
new file mode 100755
--- /dev/null
+++ b/patchconv/rapply.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# This file is part of Adblock Plus <https://adblockplus.org/>,
+# Copyright (C) 2006-present eyeo GmbH
+#
+# Adblock Plus is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by the Free Software Foundation.
+#
+# Adblock Plus is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+
+set -eu
+
+if [ $# -lt 1 ]; then
+ echo "usage: rapply.sh PATCH"
+ exit 1
+fi
+
+MESSAGE="rapply.sh $1"
+if git st >/dev/null 2>&1; then
+ alias IMPORT="git apply --index && git commit -m '$MESSAGE'"
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.
+elif hg st >/dev/null 2>&1; then
+ alias IMPORT="hg import -m '$MESSAGE' -"
+else
+ echo "No repository found in `pwd`"
+ exit 2
+fi
+
+BASEDIR=$(dirname $0)
+if [ -f "$BASEDIR/patchconv.py" ]; then
+ alias PATCHCONV="python $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.
+elif which -s patchconv; then
+ alias PATCHCONV=patchconv
+else
+ 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.
+ exit 4
+fi
+
+if [ -f "$1" ]; then
+ PATCHCONV < "$1" | IMPORT
+else
+ curl "$1" | PATCHCONV | IMPORT
+fi
« no previous file with comments | « patchconv/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld