A pure Bash mini VCS that supports multi-repo management, locking, role-based permissions, history/rollback, release packaging, build logging, and automation. The entry point is ./vcs.sh.
# initialize repo under .vcs/repos/demo
./vcs.sh init demo
# add files (from cwd workspace)
./vcs.sh -r demo add path/to/file.txt
# manage permissions
./vcs.sh -r demo auth add-user alice writer
# checkout/edit/checkin
env VCS_FAKE_USER=alice ./vcs.sh -r demo checkout path/to/file.txt
$EDITOR path/to/file.txt
env VCS_FAKE_USER=alice ./vcs.sh -r demo checkin path/to/file.txt -m "message"init <name>: create repository structure under.vcs/repos/<name>.list-repos: list known repositories.add <files...>: start tracking files (stores initial snapshot).checkout <file>: acquire lock (requires writer/admin role).edit <file>: open file in$EDITOR(defaults to nano); requires lock ownership.checkin <file> -m "<message>": record change (diffs with periodic snapshots) and release lock.status [--long]: show tracked/untracked/locked/modified files.log [--file f] [--since ts] [--until ts]: view repo or file log.auth add-user|set-role|ls: manage reader/writer/admin roles.history <file>: show per-file change history.revert <file> <objectId>: restore file to a previous object version (records new snapshot).release create|ls|extract: package latest versions as.tar.gzor inspect releases.build [--cmd "<command>"]: run build in workspace, log output tometa/build.log.unlock <file>/force-unlock <file>: release locks (force requires admin).help/help <command>: show usage.
Global flags:
-r <repo>selects repository (defaults tobasename $PWD).-h|--helpprints summary.
Roles live in meta/users per repo; defaults to granting the creator admin. Readers can inspect but not checkout/checkin. Writers/admins can edit; only admins may use force-unlock. Lock files record owner/timestamp; backups are taken automatically during checkout/checkin.
- First
addcreates a full snapshot inobjects/data/. - Subsequent
checkincreates diffs (diff -u). A full snapshot is automatically stored everySNAPSHOT_INTERVALcommits or if file exceedsSNAPSHOT_SIZE_LIMITbytes, keeping patch chains short. - Logs follow
<ISO8601> <user> <action> <file> <objectId> "<message>"format and are written both repo-wide and per-file.
Run the non-interactive test harness:
./test.sh
# or via make
make testThe suite creates a temp repo, exercises locking/roles/history/revert/releases/build, and exits non-zero if any step fails.
Produce the required submission bundle (submission.zip) via:
./package.sh
# or
make packageThe archive includes vcs.sh, test.sh, package.sh, and Makefile. Clean up with make clean.