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: Address comment 4 Created Aug. 23, 2017, 4:27 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,38 @@
+#!/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 -"
juliandoucette 2017/08/25 12:07:12 There is no --no-commit option for hg import? (I'
Sebastian Noack 2017/08/25 12:12:18 There is, at least in Mercurial 4.0, which is incl
juliandoucette 2017/08/25 12:21:28 I'm using hg --version Mercurial Distributed SCM (
Sebastian Noack 2017/08/25 13:49:53 I'm still confused why the --no-commit option is c
+else
+ echo "No repository found in `pwd`"
+ exit 2
+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