#!/bin/bash # $1 = branch # $2 = if not empty, branch has to be clean init_local_branch() { local localpath="$local_root/$1" [ -d "$localpath" ] || checkout_branch "$remote_root/$1" "$1" local repo_url=$(get_repo_url "$1") [ "$repo_url" = "$remote_root/$1" ] || error "Branch $1 has wrong repository root ($repo_url), expected $remote_root/$1" if [ -n "$2" ] then [ -z "$(do_svn status "$localpath" | $SED '/^~/d')" ] || error "Branch $1 has local changes: $(do_svn status "$localpath" | $SED '1s/^/\n/;/^~/d')" fi update_branch "$1" || error "Update of branch $1 failed" }