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: Revert the committing logic and simplify patchconv discovery Created Aug. 25, 2017, 6:50 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,43 @@
+#!/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
+
+if git st >/dev/null 2>&1; then
+ IMPORT="git apply"
+elif hg st >/dev/null 2>&1; then
+ IMPORT="hg import --no-commit -"
+else
+ echo "No repository found in `pwd`"
+ exit 2
+fi
+
+BASEDIR=$(dirname "$0")
+if [ -f "$BASEDIR/patchconv.py" ]; then
+ alias patchconv="$BASEDIR/patchconv.py"
+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