]> git.madduck.net Git - code/vcsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Add support for `vcsh pull`
authorRichard Hartmann <richih.mailinglist@gmail.com>
Fri, 5 Jul 2013 20:08:36 +0000 (22:08 +0200)
committerRichard Hartmann <richih.mailinglist@gmail.com>
Fri, 5 Jul 2013 20:08:36 +0000 (22:08 +0200)
This pulls all vcsh repos one after the other.

_vcsh
doc/vcsh.1.ronn
vcsh

diff --git a/_vcsh b/_vcsh
index 926dbc50bd11108da3bcd4f3354d8071eb80d02e..c77f2afb082c0e1d1d595723ee011bde18972c6a 100644 (file)
--- a/_vcsh
+++ b/_vcsh
@@ -43,6 +43,10 @@ function _vcsh-list-tracked-by () {
        (( CURRENT == 2 )) && __vcsh_repositories
 }
 
        (( CURRENT == 2 )) && __vcsh_repositories
 }
 
+function _vcsh-pull () {
+       _nothing
+}
+
 function _vcsh-rename () {
        (( CURRENT == 2 )) && __vcsh_repositories
        (( CURRENT == 3 )) && _message "new repository name"
 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"
                "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"
                "rename:rename a repository"
                "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set"
                "upgrade:upgrade repository to currently recommended settings"
index 9f620674a081dc0ed3095a39bfb838b2201f8d91..1592d077ff9d36dfb6b56504a8fae7a8c6227a2e 100644 (file)
@@ -21,6 +21,8 @@ vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME
 
 `vcsh` list-tracked-by <repo>
 
 
 `vcsh` list-tracked-by <repo>
 
+`vcsh` pull
+
 `vcsh` rename <repo> <newname>
 
 `vcsh` run <repo> <shell command>
 `vcsh` rename <repo> <newname>
 
 `vcsh` run <repo> <shell command>
@@ -98,6 +100,9 @@ an interactive user.
 * list-tracked-by:
   List files tracked by a repository.
 
 * list-tracked-by:
   List files tracked by a repository.
 
+* pull:
+  Pull from all vcsh remotes.
+
 * rename:
   Rename a repository.
 
 * rename:
   Rename a repository.
 
diff --git a/vcsh b/vcsh
index d7781009388e59f43638adbdbe29f63aacbe8800..e6b93778e7f928f6eda9aabfc186207b178ec556 100755 (executable)
--- a/vcsh
+++ b/vcsh
@@ -100,6 +100,7 @@ help() {
    list-tracked         List all files tracked by vcsh
    list-tracked-by \\
         <repo>          List files tracked by a repository
    list-tracked         List all files tracked by vcsh
    list-tracked-by \\
         <repo>          List files tracked by a repository
+   pull                 Pull from all vcsh remotes
    rename <repo> \\
           <newname>     Rename repository
    run <repo> \\
    rename <repo> \\
           <newname>     Rename repository
    run <repo> \\
@@ -222,6 +223,17 @@ list_tracked_by() {
        git ls-files | sort -u
 }
 
        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
 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' ] ||
        [ "$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'
        export VCSH_COMMAND="$1"
 elif [ -n "$2" ]; then
        export VCSH_COMMAND='run'