+#DATA{{{
+__DATA__
+[ALIAS]
+co = checkout
+ci = commit
+ls = list
+
+[DEFAULT]
+lib =
+ error() {
+ echo "mr: $@" >&2
+ exit 1
+ }
+ hours_since() {
+ for dir in .git .svn .bzr CVS .hg; do
+ if [ -e "$MR_REPO/$dir" ]; then
+ flagfile="$MR_REPO/$dir/.mr_last$1"
+ break
+ fi
+ done
+ if [ -z "$flagfile" ]; then
+ error "cannot determine flag filename"
+ fi
+ perl -wle 'print -f shift() ? int((-M _) * 24) : 9999' "$flagfile"
+ touch "$flagfile"
+ }
+
+update =
+ if [ -d "$MR_REPO"/.svn ]; then
+ svn update "$@"
+ elif [ -d "$MR_REPO"/.git ]; then
+ if [ -z "$@" ]; then
+ git pull -t origin master
+ else
+ git pull "$@"
+ fi
+ elif [ -d "$MR_REPO"/.bzr ]; then
+ bzr merge "$@"
+ elif [ -d "$MR_REPO"/CVS ]; then
+ cvs update "$@"
+ elif [ -d "$MR_REPO"/.hg ]; then
+ hg pull "$@" && hg update "$@"
+ else
+ error "unknown repo type"
+ fi
+status =
+ if [ -d "$MR_REPO"/.svn ]; then
+ svn status "$@"
+ elif [ -d "$MR_REPO"/.git ]; then
+ git status "$@" || true
+ elif [ -d "$MR_REPO"/.bzr ]; then
+ bzr status "$@"
+ elif [ -d "$MR_REPO"/CVS ]; then
+ cvs status "$@"
+ elif [ -d "$MR_REPO"/.hg ]; then
+ hg status "$@"
+ else
+ error "unknown repo type"
+ fi
+commit =
+ if [ -d "$MR_REPO"/.svn ]; then
+ svn commit "$@"
+ elif [ -d "$MR_REPO"/.git ]; then
+ git commit -a "$@" && git push --all
+ elif [ -d "$MR_REPO"/.bzr ]; then
+ bzr commit "$@" && bzr push
+ elif [ -d "$MR_REPO"/CVS ]; then
+ cvs commit "$@"
+ elif [ -d "$MR_REPO"/.hg ]; then
+ hg commit -m "$@" && hg push
+ else
+ error "unknown repo type"
+ fi
+diff =
+ if [ -d "$MR_REPO"/.svn ]; then
+ svn diff "$@"
+ elif [ -d "$MR_REPO"/.git ]; then
+ git diff "$@"
+ elif [ -d "$MR_REPO"/.bzr ]; then
+ bzr diff "$@"
+ elif [ -d "$MR_REPO"/CVS ]; then
+ cvs diff "$@"
+ elif [ -d "$MR_REPO"/.hg ]; then
+ hg diff "$@"
+ else
+ error "unknown repo type"
+ fi
+log =
+ if [ -d "$MR_REPO"/.svn ]; then
+ svn log"$@"
+ elif [ -d "$MR_REPO"/.git ]; then
+ git log "$@"
+ elif [ -d "$MR_REPO"/.bzr ]; then
+ bzr log "$@"
+ elif [ -d "$MR_REPO"/CVS ]; then
+ cvs log "$@"
+ elif [ -d "$MR_REPO"/.hg ]; then
+ hg log "$@"
+ else
+ error "unknown repo type"
+ fi
+register =
+ if [ -n "$1" ]; then
+ cd "$1"