Like git track-review, this grabs a branch for a gerrit change (with git
gerrit-track), extracts it into patches, and runs checkpatch.

It could just as easily call git checkpatch, but breaking it into .patches
helps a little.

Signed-off-by: Barret Rhoden <[email protected]>
---
 scripts/git/git-gerrit-track-review | 52 +++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100755 scripts/git/git-gerrit-track-review

diff --git a/scripts/git/git-gerrit-track-review 
b/scripts/git/git-gerrit-track-review
new file mode 100755
index 000000000000..47b679256c15
--- /dev/null
+++ b/scripts/git/git-gerrit-track-review
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Barret Rhoden ([email protected])
+# Copyright 2016 Google Inc
+#
+# Tracks a gerrit branch and runs checkpatch on the commits from the
+# merge point of master to the tip of the branch.
+
+PATCHDIR="${PATCHDIR:-../patches}"
+
+usage()
+{
+       echo "$0 <gerrit-number> <local-branch-name>"
+       exit -1
+}
+
+if [ $# -lt 2 ]
+then
+       usage
+fi
+
+if [ ! -f ./scripts/checkpatch.pl ]
+then
+       echo "Run from the root of the Akaros repo"
+       exit -1
+fi
+
+git gerrit-track $1 $2
+
+if [ $? -ne 0 ]
+then
+       exit -1
+fi
+
+FROM=`git merge-base master $2`
+
+if [ $? -ne 0 ]
+then
+       echo "From failed; $FROM"
+       exit -1
+fi
+
+ls $PATCHDIR/*.patch 2>/dev/null
+
+if [ $? -eq 0 ]
+then
+       echo "$PATCHDIR has patches, remove and try again"
+       exit -1
+fi
+
+git format-patch -k -M -N -o $PATCHDIR $FROM..$2
+
+./scripts/checkpatch.pl $PATCHDIR/*
-- 
2.8.0.rc3.226.g39d4020

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to