summaryrefslogtreecommitdiff
path: root/rvi
diff options
context:
space:
mode:
Diffstat (limited to 'rvi')
-rwxr-xr-xrvi35
1 files changed, 35 insertions, 0 deletions
diff --git a/rvi b/rvi
new file mode 100755
index 0000000..c43226b
--- /dev/null
+++ b/rvi
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+if ! [ -e "$1" ] ; then
+ echo "$1 does not exist." >&2
+ exit 1
+fi
+
+DN=`dirname "$1"`
+BN=`basename "$1"`
+if ! [ -e "$1,v" ] && ! [ -e "$DN/RCS/$BN,v" ] ; then
+ echo "Neither $1,v nor $DN/RCS/$BN,v do not exist." >&2
+ exit 1
+fi
+
+rcsdiff -u $1
+if [ $? -ne 0 ] ; then
+ rcsdiff $1 > $1.rvi.diff
+ echo
+ echo "Differences detected"
+ echo "run 'co $1' to overwrite with last committed version"
+ echo "or 'co -l $1; patch $1 < $1.rvi.diff; ci -u $1' to commit"
+ exit 1
+fi
+rm -f $1.rvi.diff
+
+co -l $1
+if [ $? -ne 0 ] ; then
+ echo "Check out failed."
+ echo "Maybe someone else is currently editing this file."
+ echo "Aborting rvi."
+ exit 1
+fi
+/usr/bin/vim $1
+ci -u $1
+