Page MenuHomePhabricator

arc_preview

Authored By
sshannin
Mar 4 2015, 6:33 PM
Size
1 KB
Referenced Files
None
Subscribers
None

arc_preview

#!/bin/bash
set -e
usage ()
{
echo "Usage: arc_preview [ -d Diff ID ]"
echo ""
echo "Will detect your local arc Diff ID and your local svn repo"
echo "to provide a diff of what has changed. This semantically"
echo "should tell you what has changed since your last 'arc diff'."
echo "If -d is provided, it will be used as the Diff ID rather than"
echo "detecting and using your most recent diff."
exit 1
}
diff=""
while getopts ":d:" opt; do
case "$opt" in
d) diff=$OPTARG
;;
*)
usage
;;
esac
done
if [ -z "$diff" ];
then
diff=`arc which | grep -o "D[1-9][0-9]*"`
fi
base_checkout=`svn info | grep ^URL | cut -d" " -f2`
if [ -z "$diff" ];
then
echo "Unable to find diff for working directory"
exit
fi
if [ -z "$base_checkout" ];
then
echo "Unable to find svninfo for working directory"
exit
fi
echo "Diff is $diff"
echo "Base Revision is $base_checkout"
curr_dir=`pwd`
## start with a fresh tmp dir
tmp_dir=`mktemp -d`
function cleanup {
rm -rf $tmp_dir
}
trap 'cleanup' EXIT
## checkout the base revision and apply the patch
svn co $base_checkout $tmp_dir --quiet
cd $tmp_dir
## patch it up and hide some noise
arc patch --force ${diff} | grep -v "^patching file" |
grep -v "^[A|U|D] "
cd $curr_dir
## perform our diff
diff -ru $tmp_dir $curr_dir --exclude=".svn"

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/7o/w6/r3ieidybe2svgrse
Default Alt Text
arc_preview (1 KB)

Event Timeline