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 |