#! /bin/sh if [ -z "$2" -o -n "$3" ]; then echo "Usage: $0 old_name new_name" >&2 exit 1 fi old_name="$1" new_name="$2" fix_path() { config_option="$1" path="`git config --get $config_option`" new_path="`echo \"$path\" | sed \"s@$old_name@$new_name@\"`" git config "$config_option" "$new_path" } fix_files() { for file in "$@"; do if [ -f "$file" ]; then sed -i /"$old_name"/"$new_name"/g "$file" fi done } for project_dir in "$HOME"/prog/Python "$HOME"/current/projects \ "$HOME"/Internet/WWW/htdocs/git.phdru.name; do cd "$project_dir" && if [ -d "$old_name" ]; then mv "$old_name" "$new_name" && cd "$new_name" elif [ -d "$old_name.git" ]; then mv "$old_name".git "$new_name".git && cd "$new_name".git else continue fi for remote in `git remote`; do fix_path "remote.$remote.url" done path="`git config --get --path htdocs.path`" if [ -n "$path" ]; then ( cd /home/phd/Internet/WWW/htdocs/phdru.name/Software/Python/ && if [ -d "$old_name" ]; then mv "$old_name" "$new_name" && cd "$new_name" && mv "$old_name"-*.tar.bz2 "$new_name".tar.bz2 && fix_files index.tmpl fi ) && fix_path htdocs.path fi fix_files devscripts/README.html \ docs/conf.py docs/genapidocs docs/index.rst docs/install.rst \ README.rst mk-distr setup.py tox.ini done