X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/72bfba156f1e5423462126cd84a2b9034617668d..1d8970fdb8d4adbfd5cdecc5d15da9db61efb39d:/vcsh diff --git a/vcsh b/vcsh index 7a0f712..159feda 100755 --- a/vcsh +++ b/vcsh @@ -24,7 +24,7 @@ basename() { } SELF=$(basename $0) -VERSION='1.2' +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'