akaros/scripts/git/git-gerrit-track-review
<<
>>
Prefs
   1#!/bin/bash
   2# Barret Rhoden (brho@cs.berkeley.edu)
   3# Copyright 2016 Google Inc
   4#
   5# Tracks a gerrit branch and runs checkpatch on the commits from the
   6# merge point of master to the tip of the branch.
   7
   8PATCHDIR="${PATCHDIR:-../patches}"
   9
  10usage()
  11{
  12        echo "$0 <gerrit-number> <local-branch-name>"
  13        exit -1
  14}
  15
  16if [ $# -lt 2 ]
  17then
  18        usage
  19fi
  20
  21if [ ! -f ./scripts/checkpatch.pl ]
  22then
  23        echo "Run from the root of the Akaros repo"
  24        exit -1
  25fi
  26
  27git gerrit-track $1 $2
  28
  29if [ $? -ne 0 ]
  30then
  31        exit -1
  32fi
  33
  34FROM=`git merge-base master $2`
  35
  36if [ $? -ne 0 ]
  37then
  38        echo "From failed; $FROM"
  39        exit -1
  40fi
  41
  42ls $PATCHDIR/*.patch 2>/dev/null
  43
  44if [ $? -eq 0 ]
  45then
  46        echo "$PATCHDIR has patches, remove and try again"
  47        exit -1
  48fi
  49
  50git format-patch -k -M -N -o $PATCHDIR $FROM..$2
  51
  52./scripts/checkpatch.pl $PATCHDIR/*
  53