+[ALIAS]
+co = checkout
+ci = commit
+ls = list
+
+[DEFAULT]
+order = 10
+lib =
+ error() {
+ echo "mr: $@" >&2
+ exit 1
+ }
+ hours_since() {
+ if [ -z "$1" ] || [ -z "$2" ]; then
+ error "mr: usage: hours_since action num"
+ fi
+ for dir in .git .svn .bzr CVS .hg _darcs; 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
+ delta=$(perl -wle 'print -f shift() ? int((-M _) * 24) : 9999' "$flagfile")
+ if [ "$delta" -lt "$2" ]; then
+ exit 0
+ else
+ touch "$flagfile"
+ exit 1
+ fi
+ }
+
+update =
+ if [ -d "$MR_REPO"/.svn ]; then
+ svn update "$@"
+ elif [ -d "$MR_REPO"/.git ] || [ "${MR_REPO%.git/}" != "$MR_REPO" ]; then
+ # this is a bug in git-fetch, which requires GIT_DIR set
+ [ "${MR_REPO%.git/}" != "$MR_REPO" ] && GIT_DIR="$MR_REPO" && export GIT_DIR
+ if [ -z "$@" ]; then
+ git pull -t origin master
+ else
+ git pull "$@"
+ fi
+ unset GIT_DIR
+ 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 "$@"
+ elif [ -d "$MR_REPO"/_darcs ]; then
+ darcs pull -a "$@"
+ else
+ error "unknown repo type"
+ fi
+status =
+ if [ -d "$MR_REPO"/.svn ]; then
+ svn status "$@"
+ elif [ -d "$MR_REPO"/.git ] || [ "${MR_REPO%.git/}" != "$MR_REPO" ]; 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 "$@"
+ elif [ -d "$MR_REPO"/_darcs ]; then
+ darcs whatsnew -ls "$@"
+ 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 [ "${MR_REPO%.git/}" != "$MR_REPO" ]; then
+ error "commit does not work for fake bare git repositories (yet)."
+ 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
+ elif [ -d "$MR_REPO"/_darcs ]; then
+ darcs commit -a -m "$@" && darcs push -a
+ else
+ error "unknown repo type"
+ fi
+diff =
+ if [ -d "$MR_REPO"/.svn ]; then
+ svn diff "$@"
+ elif [ -d "$MR_REPO"/.git ]; then
+ git diff "$@"
+ elif [ "${MR_REPO%.git/}" != "$MR_REPO" ]; then
+ error "commit does not work for fake bare git repositories (yet)."
+ elif [ -d "$MR_REPO"/.bzr ]; then
+ bzr diff "$@"
+ elif [ -d "$MR_REPO"/CVS ]; then
+ cvs diff "$@"
+ elif [ -d "$MR_REPO"/.hg ]; then
+ hg diff "$@"
+ elif [ -d "$MR_REPO"/_darcs ]; then
+ darcs diff "$@"
+ else
+ error "unknown repo type"