X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/be1c81ee11c7c97d20dcb63b4f8d46febcbc875f..00e3e4ee67e7724e8b90f32abc67c05ac37720b7:/vcsh?ds=inline diff --git a/vcsh b/vcsh index 63e726e..a5c3f48 100755 --- a/vcsh +++ b/vcsh @@ -19,7 +19,7 @@ # If '.git-HEAD' is appended to the version, you are seeing an unreleased # version of vcsh; the master branch is supposed to be clean at all times # so you can most likely just use it nonetheless -VERSION='1.20141025' +VERSION='1.20141026' SELF=$(basename $0) fatal() { @@ -214,6 +214,16 @@ enter() { hook post-enter } +foreach() { + hook pre-foreach + for VCSH_REPO_NAME in $(list); do + GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR + use + "$@" + done + hook post-foreach +} + git_dir_exists() { [ -d "$GIT_DIR" ] || fatal "no repository found for '$VCSH_REPO_NAME'" 12 } @@ -546,6 +556,9 @@ elif [ x"$VCSH_COMMAND" = x'delete' ] || [ x"$VCSH_COMMAND" = x'rename' ] && { VCSH_REPO_NAME_NEW=$3; export VCSH_REPO_NAME_NEW; GIT_DIR_NEW=$VCSH_REPO_D/$VCSH_REPO_NAME_NEW.git; export GIT_DIR_NEW; } [ x"$VCSH_COMMAND" = x'run' ] && shift 2 +elif [ x"$VCSH_COMMAND" = x'foreach' ]; then + [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a command" 1 + shift 1 elif [ x"$VCSH_COMMAND" = x'commit' ] || [ x"$VCSH_COMMAND" = x'list' ] || [ x"$VCSH_COMMAND" = x'list-tracked' ] ||