From: Richard Hartmann Date: Fri, 5 Jul 2013 20:08:36 +0000 (+0200) Subject: Add support for `vcsh pull` X-Git-Url: https://git.madduck.net/code/vcsh.git/commitdiff_plain/8f4a012b3bc70e1d33bdba17e5c319c00c829c2a?ds=inline Add support for `vcsh pull` This pulls all vcsh repos one after the other. --- diff --git a/_vcsh b/_vcsh index 926dbc5..c77f2af 100644 --- a/_vcsh +++ b/_vcsh @@ -43,6 +43,10 @@ function _vcsh-list-tracked-by () { (( CURRENT == 2 )) && __vcsh_repositories } +function _vcsh-pull () { + _nothing +} + function _vcsh-rename () { (( CURRENT == 2 )) && __vcsh_repositories (( CURRENT == 3 )) && _message "new repository name" @@ -88,6 +92,7 @@ function _vcsh () { "list:list all local vcsh repositories" "list-tracked:list all files tracked by vcsh" "list-tracked-by:list files tracked by a repository" + "pull:pull from all vcsh remotes" "rename:rename a repository" "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set" "upgrade:upgrade repository to currently recommended settings" diff --git a/doc/vcsh.1.ronn b/doc/vcsh.1.ronn index 9f62067..1592d07 100644 --- a/doc/vcsh.1.ronn +++ b/doc/vcsh.1.ronn @@ -21,6 +21,8 @@ vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME `vcsh` list-tracked-by +`vcsh` pull + `vcsh` rename `vcsh` run @@ -98,6 +100,9 @@ an interactive user. * list-tracked-by: List files tracked by a repository. +* pull: + Pull from all vcsh remotes. + * rename: Rename a repository. diff --git a/vcsh b/vcsh index d778100..e6b9377 100755 --- a/vcsh +++ b/vcsh @@ -100,6 +100,7 @@ help() { list-tracked List all files tracked by vcsh list-tracked-by \\ List files tracked by a repository + pull Pull from all vcsh remotes rename \\ Rename repository run \\ @@ -222,6 +223,17 @@ 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 +} + rename() { git_dir_exists [ -d "$GIT_DIR_NEW" ] && fatal "'$GIT_DIR_NEW' exists" 54 @@ -328,7 +340,8 @@ elif [ "$1" = 'delete' ] || [ "$VCSH_COMMAND" = 'run' ] && shift 2 [ "$VCSH_COMMAND" = 'write-gitignore' ] elif [ "$1" = 'list' ] || - [ "$1" = 'list-tracked' ]; then + [ "$1" = 'list-tracked' ] || + [ "$1" = 'pull' ]; then export VCSH_COMMAND="$1" elif [ -n "$2" ]; then export VCSH_COMMAND='run'