#!/bin/bash # # Copyright (C) 2005, # Stefano Zacchiroli # Enrico Tassi # Mikael Berthe # # This is free software, you can redistribute it and/or modify it under the # terms of the GNU General Public License version 2 as published by the Free # Software Foundation. # vimdiff="vimdiff" suffix="vimhgdiff" files="$1" if [ -z "$files" ]; then files=$(hg status 2> /dev/null | grep "^M " | cut -c 3-) fi for f in $files; do if ! [ -f $f ]; then break; fi patch=`tempfile -p $suffix` orig=`tempfile -p $suffix` # We should check if the file belongs to the repository #cut -d '/' -f 2 < CVS/Entries | grep "^$f\$" > /dev/null || break trap "rm -f $patch $orig" EXIT cp "$f" $orig hg diff "$f" > $patch if ! [ $? -eq 0 ]; then echo "hg diff error for $f" >&2 rm -f $patch $orig continue fi patch -R -p0 $orig $patch $vimdiff $orig $f rm -f $patch $orig done