#! /bin/sh patchfile=$1 echo "#! /bin/sh" echo # Find deleted files. deleted=`grep -B 1 -- "^+++ /dev/null" $patchfile | grep -- "^--- " | sed 's|^--- a/||'` if [ -n "$deleted" ]; then echo "# Removed files." echo "pcvs rm $deleted" | tr '\n' ' ' echo fi # Find new files. added=`grep -A 1 -- "^--- /dev/null" $patchfile | grep -- "^+++ " | sed 's|^+++ b/||'` newdirs=`echo $added | tr ' ' '\n' | sed -E 's|/[^/]+$||' | sort -u` if [ -n "$newdirs" ]; then echo "# Possible new directories." for i in $newdirs; do echo "pcvs add $i" done fi if [ -n "$added" ]; then echo "# New files." echo "pcvs add $added" | tr '\n' ' ' echo fi minus=`grep -- "^--- " $patchfile | sed '/\/dev\/null/d;s|^--- a/||'` plus=`grep -- "^+++ " $patchfile | sed '/\/dev\/null/d;s|^+++ b/||'` if [ -n "$plus" -o -n "$minus" ]; then echo "# Let's go!" echo "pcvs ci $plus $minus" | tr '\n' ' ' echo fi