Created
February 4, 2013 23:55
-
-
Save DennisTT/4710888 to your computer and use it in GitHub Desktop.
Opens up DiffMerge comparing a local version of the file (base) with a modified version on a remote machine. Assumes that the directory structure is the same after "cache directory" configuration value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Opens up DiffMerge comparing a local version of the file (base) with a modified version | |
# on a remote machine. Assumes that the directory structure is the same after "cache | |
# directory" configuration value. | |
# Configuration values | |
LOCALCACHEDIR="/var/repo/cache/" | |
REMOTECACHEDIR="/home/remoteuser/repo/cache/" | |
REMOTESERVERNAME="staging" | |
# End configuration | |
FOLDERNAME=$(dirname $1) | |
LOCALDIR=$LOCALCACHEDIR$FOLDERNAME | |
REMOTEDIR=$REMOTECACHEDIR$FOLDERNAME | |
LOCALFILE=$LOCALCACHEDIR$1 | |
REMOTEFILE=$REMOTECACHEDIR$1 | |
TEMPFILE="/tmp/$(basename $0).$$.tmp" | |
# Update local version | |
( | |
cd $LOCALDIR | |
git pull | |
) | |
# Check local file exists | |
if [ ! -f $LOCALFILE ]; then | |
echo "$LOCALFILE does not exist" | |
exit 1 | |
fi | |
# Get remote version into temp file | |
scp $REMOTESERVERNAME:$REMOTEFILE $TEMPFILE | |
# Open up diff | |
( | |
diffmerge $LOCALFILE $TEMPFILE | |
rm $TEMPFILE | |
) & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment