#!/bin/sh
# Filename:      hgvimdiff
# Purpose:       run vim in diff mode for use with mercurial using DirDiff.vim
# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2.
# Latest change: Son Okt 22 23:56:59 CEST 2006 [mika]
################################################################################
# Needs $HOME/.vim/plugin/DirDiff.vim (plugin to diff and merge
# two directories recursively), taken from
# http://www.vim.org/scripts/script.php?script_id=102
# wget http://www.vim.org/scripts/download_script.php?src_id=5306 -O ~/.vim/plugin/DirDiff.vim

if [ -n "$@" ] ; then
   echo "Usage: hgvimdiff <srcdir1> <srcdir2>" >&2
   echo "hgvimdiff is considered to be used through extdiff within mercurial"
   exit 1
fi

if [ -r "$HOME/.vim/plugin/DirDiff.vim" ] ; then
  /usr/bin/vim -f '+next' '+execute "DirDiff" argv(0) argv(1)' "$@"
else
  /usr/bin/vim -c ":echoerr 'Running hgvimdiff failed! Please read man hgvimdiff'"
fi

## END OF FILE #################################################################
