#!/bin/sh

VERSION=$1

if [ ! "$VERSION" ]; then
    cat 1>&2 <<EOF
Need a version to retrieve from the history. Maybe try one of the following:

EOF
    hg tags 1>&2
    exit 1
fi

  hg cat -r "$VERSION" cartridge.scad \
| sed 's/module cartridge/module cartridge_old/;s/cartridge()/cartridge_old()/' \
> cartridge-old.scad
