X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/11925032e3a7e25d65d5535a4050d5fdb1f73b2a..16f1439e7353a5afb9ebbc6d22288dd47061ac29:/vcsh diff --git a/vcsh b/vcsh index 2509b66..159feda 100755 --- a/vcsh +++ b/vcsh @@ -24,7 +24,7 @@ basename() { } SELF=$(basename $0) -VERSION='1.3' +VERSION='1.20130614' fatal() { echo "$SELF: fatal: $1" >&2 @@ -100,6 +100,8 @@ help() { list-tracked List all files tracked by vcsh list-tracked-by \\ List files tracked by a repository + pull Pull from all vcsh remotes + push Push to vcsh remotes rename \\ Rename repository run \\ @@ -131,6 +133,7 @@ info() { } clone() { + hook pre-clone init git remote add origin "$GIT_REMOTE" git config branch.master.remote origin @@ -149,6 +152,7 @@ clone() { fatal "will stop after fetching and not try to merge! Once this situation has been resolved, run 'vcsh run $VCSH_REPO_NAME git pull' to finish cloning.\n" 17 git merge origin/master + hook post-clone } delete() { @@ -220,6 +224,28 @@ list_tracked_by() { git ls-files | sort -u } +pull() { + hook pre-pull + for VCSH_REPO_NAME in $(list); do + echo -n "$VCSH_REPO_NAME: " + export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" + use + git pull + done + hook post-pull +} + +push() { + hook pre-push + for VCSH_REPO_NAME in $(list); do + echo -n "$VCSH_REPO_NAME: " + export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" + use + git push + done + hook post-push +} + rename() { git_dir_exists [ -d "$GIT_DIR_NEW" ] && fatal "'$GIT_DIR_NEW' exists" 54 @@ -326,7 +352,9 @@ elif [ "$1" = 'delete' ] || [ "$VCSH_COMMAND" = 'run' ] && shift 2 [ "$VCSH_COMMAND" = 'write-gitignore' ] elif [ "$1" = 'list' ] || - [ "$1" = 'list-tracked' ]; then + [ "$1" = 'list-tracked' ] || + [ "$1" = 'pull' ] || + [ "$1" = 'push' ]; then export VCSH_COMMAND="$1" elif [ -n "$2" ]; then export VCSH_COMMAND='run'