--- /dev/null
+#!/bin/bash
+
+tmp=$(mktemp)
+cat << \EOF > ${tmp}
+decode() {
+ awk -vid="$1" -vtype="$2" '$1 == id {
+ print "export GIT_"type"_NAME='\''" $3 " " $4 "'\'';"
+ print "export GIT_"type"_EMAIL='\''" $5 "'\'';"
+ }' ${author_file}
+}
+EOF
+
+for x in cvs-authors authors ; do
+ export author_file=${PWD}/.git/$x
+ [ -e ${author_file} ] && break
+done
+git filter-branch \
+ --env-filter ". ${tmp};"' \
+ eval `decode "${GIT_AUTHOR_NAME}" AUTHOR`; \
+ eval `decode "${GIT_COMMITTER_NAME}" COMMITTER`; \
+' "$@"
+
+rm -f $tmp
--- /dev/null
+#!/bin/sh
+
+gdir=".git"
+if [ ! -d ${gdir} ] ; then
+ echo "Run this is in the root of the git tree"
+ exit 1
+fi
+
+revmap() {
+ find ${gdir}/svn/$1/ '(' -name '.rev_map.*' -a '!' -name '*.bak' ')' -print
+}
+
+decode() {
+ xxd -c24 < $1
+}
+encode() {
+ xxd -c24 -r
+}
+
+get_branch() {
+ branch=${1:-trunk}
+ if [ ! -d ${gdir}/svn/${branch} ] ; then
+ echo "Branch ${branch} not in ${gdir}/svn/"
+ exit 1
+ fi
+
+ map=$(revmap ${branch})
+
+ cur_rev=$(printf '%i' 0x$(decode $map | tail -n1 | awk '{print $3}'))
+}
+
+show() {
+ get_branch "$@"
+ echo "${branch}: at rev ${cur_rev}"
+ exit 0
+}
+
+reset() {
+ get_branch "$@"
+ new_rev=$2
+ if [ -z "$new_rev" ] || [ "$new_rev" -gt "$cur_rev" ] ; then
+ echo "${branch}: invalid rev '$new_rev' (at $cur_rev)"
+ exit 1
+ fi
+
+ printf "really reset $branch to $new_rev ? [y/N] "
+ read ans
+ case ${ans} in
+ [yY]) ;;
+ *) exit 1;;
+ esac
+
+ hex0=$(printf '%04x' $(( new_rev % 0x10000 )) )
+ hex1=$(printf '%04x' $(( new_rev / 0x10000 )) )
+ cp $map $map.bak
+ decode $map.bak \
+ | sed -n "1,/^[^:]*: $hex1 $hex0/p" \
+ | encode \
+ > $map
+
+ show ${branch}
+ echo "don't forget to reset manually ref/remotes/${branch}"
+}
+
+usage() {
+ echo "Unknown op '$op'"
+ exit 1
+}
+
+branch=
+op=$1
+shift
+case $op in
+ -s) show "$@";;
+ -r) reset "$@";;
+ *) usage;;
+esac