datatracker/bin/mkdevbranch
Henrik Levkowetz 0d00842ffe Updated version of mkdevbranch.
- Legacy-Id: 7890
2014-06-12 10:07:34 +00:00

105 lines
3.7 KiB
Bash
Executable file

#!/bin/bash
version=0.23
program=${0##*/}
progdir=${0%/*}
if [ "$progdir" = "$program" ]; then progdir="."; fi
function die() {
echo -e "\n$program: Error: ${1:0:160} ..." >&2
exit 1
}
function warn() {
logger -i -p user.warn -t $program "$*"
echo "$program: Warning: $*" 1>&2;
}
function note() {
logger -i -p user.notice -t $program "$*"
if [ -n "$OPT_VERBOSE" ]; then echo -e "$*"; fi
}
function version() {
echo -e "$program: v$version\n\nRunning as $(id -urn) on $(date +'%Y-%m-%d %H:%M')"
}
#[ "$#" -gt 0 ] || die "Expected the ietf number as argument on the command line, but found nothing"
#[ $1 -gt 70 ] || die "Expected the ietf number as argument on the command line, but found '$1'"
#if [ "$1" ]; then arg=$1; else arg=$(svn info http://svn.tools.ietf.org/svn/tools/ietfdb/trunk/ | egrep "^Last Changed Rev" | awk '{print $4}'); fi
if [ "$1" ]; then arg=$1; else arg=$(svn ls http://svn.tools.ietf.org/svn/tools/ietfdb/tags/ | grep '^[1-9]' | tail -n 1 | sed -r 's/^(.*)\/$/v\1/' ); fi
if [ "${arg:0:1}" = "v" ]; then
source="tags/${arg:1}"
target="$arg"
rev="release $arg"
else
source="trunk@$arg"
target="r$arg"
rev="repository rev r$arg"
fi
function mksvndir() {
who=$1
if [ "$2" ]; then dir=$2; else dir=$who; fi
if ! svn info http://svn.tools.ietf.org/svn/tools/ietfdb/personal/$dir >/dev/null 2>&1 ; then
echo "Creating personal directory area for IETF datatracker coding: /personal/$dir"
svn mkdir http://svn.tools.ietf.org/svn/tools/ietfdb/personal/$dir -m "Personal SVN dir for $who, for IETF datatracker code"
else
echo "Repository area personal/$dir is already in place."
fi
}
cd $progdir
num=$( < /www/tools.ietf.org/meta/current-ietf-number.txt)
for n in $(seq $((num-3)) $num); do
trac-admin /www/tools.ietf.org/tools/ietfdb wiki export IETF${n}SprintSignUp \
| egrep "^\|\|" | tail -n +2 | python -c '
import sys, re
afile = open("aliases")
aliases = dict([ line.strip().split(None,1) for line in afile.read().splitlines() ])
for line in sys.stdin:
blank, name, email, rest = line.strip().split("||", 3)
login, dummy = re.split("[@.]", email, 1)
if login in aliases:
login = aliases[login]
print "\t".join((login.strip().lower(), email.strip().lower(), name.strip())) ' \
| update $progdir/sprint$n.txt
done
cat $(ls $progdir/sprint*.txt | tail -n 2) $progdir/extras.txt | sed 's/[ \t]*$//' | sort | uniq | while read login email name; do
echo ""
echo "$login ($name <$email>):"
mksvndir $login
if ! svn info http://svn.tools.ietf.org/svn/tools/ietfdb/personal/$login/$target >/dev/null 2>&1 ; then
echo " creating $target branch for $login ($name)."
svn cp http://svn.tools.ietf.org/svn/tools/ietfdb/$source http://svn.tools.ietf.org/svn/tools/ietfdb/personal/$login/$target/ -m "New IETF datatracker coding branch for $name" \
&& mail "$name <$email>" -s "A new SVN branch for you for IETF datatracker coding${rev:+, based on $rev}." -b henrik@levkowetz.com <<-EOF
Hi,
This mail has been automatically generated by the $program script.
A new SVN branch has been set up for you for IETF datatracker coding, at
http://svn.tools.ietf.org/svn/tools/ietfdb/personal/$login/$target
${rev:+This branch is based on $rev. }You can check it out by doing
svn co http://svn.tools.ietf.org/svn/tools/ietfdb/personal/$login/$target
Please read the instructions about sprint coder setup at
http://trac.tools.ietf.org/tools/ietfdb/wiki/SprintCoderSetup
-- both the workflow description and the details of setting up your
environment.
Best regards,
Henrik (via the $program script)
EOF
else
echo " branch personal/$login/$target already exists."
fi
done