#!/bin/sh set -eu usage="Store the contents of ORIGINIAL as a new revision in RCSFILE. Then, maintain a checked-out list of the four most recent verisons, named DIR/YYYY-MM-DD.SUFFIX, where YYYY, MM and DD are from ORIGINAL's modification time." eval "$(args rcs-stash original rcsfile dir suffix -- "$@")" case "$rcsfile" in *",v" ) ;; * ) echo "rcs-stash: not an RCS ,v file: $rcsfile" >&2 exit 2 ;; esac temp="$dir/$(basename "$rcsfile" ,v)" # Redirecting ci's input from /dev/null seems to be the only way to # avoid creating a log message. ci -u "$original" "$rcsfile" < /dev/null co -u -M "$rcsfile" "$temp" mv "$temp" "$dir/$(date -r "$temp" +%Y-%m-%d).${suffix}" keep-at-most 4 "$dir/"????-??-??".${suffix}"