akaros/scripts/git/post-am.sh
<<
>>
Prefs
   1#!/bin/bash
   2# Barret Rhoden (brho@cs.berkeley.edu)
   3# Copyright 2016 Google Inc
   4#
   5# I run this after doing a git am and after I am OK with merging.
   6# 
   7# Prints a blob of text describing the changes from (FROM..TO].
   8# By default, it applies to master..origin/master, but you can override that.
   9
  10FROM="origin/master"
  11TO="master"
  12
  13usage()
  14{
  15        echo "$0 [<from>..<to>]"
  16        exit -1
  17}
  18
  19if [ $# -gt 1 ]
  20then
  21        usage
  22fi
  23
  24if [ $# -eq 1 ]
  25then
  26        FROM=`echo $1 | cut -f 1 -d '.'`
  27        TO=`echo $1 | cut -f 3 -d '.'`
  28fi
  29
  30FROM_SHA=`git log --format=format:%h -1 $FROM`
  31TO_SHA=`git log --format=format:%h -1 $TO`
  32
  33echo "Merged to master at $FROM_SHA..$TO_SHA (from, to]"
  34echo ""
  35echo "You can see the entire diff with 'git diff' or at" 
  36echo "https://github.com/brho/akaros/compare/$FROM_SHA...$TO_SHA"
  37echo ""
  38