Added git-pull-all-branches. Removed svnst cruft.
This commit is contained in:
parent
aade651214
commit
c12a37f8e8
1 changed files with 13 additions and 20 deletions
33
zsh/zshrc
33
zsh/zshrc
|
|
@ -238,6 +238,7 @@ alias glo='git log --oneline'
|
||||||
alias gls='git log --stat'
|
alias gls='git log --stat'
|
||||||
alias g='git grep'
|
alias g='git grep'
|
||||||
alias m='git merge'
|
alias m='git merge'
|
||||||
|
alias pab='git-pull-all-branches'
|
||||||
alias r='git remote'
|
alias r='git remote'
|
||||||
alias ra='git remote add'
|
alias ra='git remote add'
|
||||||
alias s='git status'
|
alias s='git status'
|
||||||
|
|
@ -247,27 +248,19 @@ if mac; then
|
||||||
alias -g apache2ctl=/opt/local/apache2/bin/apachectl
|
alias -g apache2ctl=/opt/local/apache2/bin/apachectl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function svnst() {
|
git-pull-all-branches() {
|
||||||
tmpfile=/tmp/svn-stat.$$
|
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
[[ -f $tmpfile ]] && rm -f $tmpfile
|
echo "$pwd is not part of a git repo"
|
||||||
svn stat
|
return
|
||||||
svn diff > $tmpfile
|
|
||||||
typeset -i added deled delta
|
|
||||||
added=`grep '^+' $tmpfile | wc -l`
|
|
||||||
deled=`grep '^-' $tmpfile | wc -l`
|
|
||||||
delta=$((added - deled))
|
|
||||||
if [[ delta -gt 0 ]]; then
|
|
||||||
delta_w=added
|
|
||||||
delta_sym='+'
|
|
||||||
else
|
|
||||||
delta_w=deleted
|
|
||||||
delta_sym='-'
|
|
||||||
delta=$((0 - delta))
|
|
||||||
fi
|
fi
|
||||||
echo " + ${added} lines"
|
origbranch=$(git branch | fgrep '*' | sed -e 's/\*//')
|
||||||
echo " - ${deled} lines"
|
bs=($@)
|
||||||
echo "= ${delta_sym} ${delta} lines"
|
[[ -z "$bs" ]] && bs=($(git branch | sed -e 's/\*//'))
|
||||||
rm -f $tmpfile
|
for b ($bs) {
|
||||||
|
git checkout "$b"
|
||||||
|
git pull origin "$b"
|
||||||
|
}
|
||||||
|
git checkout "$origbranch"
|
||||||
}
|
}
|
||||||
|
|
||||||
function e() {
|
function e() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue