fh: file history
- no support for multi-user environments (no locking, etc.)
- implemented in shell script
- must use ed(1)
- should work or easily be made to work on 7th Edition UNIX
I've taken care not to use any shell scripting constructions that didn't exist in the Bourne shell, but I may have missed things; however, the shebang needs to be removed on 7th Edition UNIX.
fh uses a chain of ed(1) scripts to construct any version of a file. It even allows recording of commit messages.
I saw the following passage in diff(1) of 7th Edition UNIX:
The -e option produces a script of a, c and d commands for the editor ed, which will recreate file2 from file1. The -f option produces a similar script, not useful with ed, in the opposite order. In connection with -e, the following shell program may help maintain multiple versions of a file. Only an ancestral file ($1) and a chain of version-to-version ed scripts ($2,$3,...) made by diff need be on hand. A `latest version' appears on the standard output.
(shift; cat $*; echo ´1,$p´) ⎪ ed - $1
After some thinking, I figured it would be hilarious to actually implement a basic version control system on these primitives. In hindsight, it's probably closer to terrifying than hilarious.
ISC, see LICENSE.
Installation and usage
fu files to a directory in
make sure they are marked as executable.
Copy the man pages
fh.5 to a directory in
For usage, see the supplied man pages. man.md is available on the web. For 7th Edition UNIX, the man pages written in mdoc macrosneed to be converted to old man macros first:
mkdir man mandoc -Tman fl.1 > man/fl.1 mandoc -Tman fr.1 > man/fr.1 mandoc -Tman fu.1 > man/fu.1 mandoc -Tman fh.5 > man/fh.5