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

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 retire() as a complement to use()
[code/vcsh.git] / vcsh
diff --git a/vcsh b/vcsh
index d7781009388e59f43638adbdbe29f63aacbe8800..15ea0984f87a0540caef0c146fb76ca481d2bf86 100755 (executable)
--- a/vcsh
+++ b/vcsh
@@ -100,6 +100,8 @@ help() {
    list-tracked         List all files tracked by vcsh
    list-tracked-by \\
         <repo>          List files tracked by a repository
+   pull                 Pull from all vcsh remotes
+   push                 Push to vcsh remotes
    rename <repo> \\
           <newname>     Rename repository
    run <repo> \\
@@ -222,6 +224,33 @@ 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
+}
+
+retire() {
+       unset GIT_WORK_TREE
+       unset VCSH_DIRECTORY
+}
+
 rename() {
        git_dir_exists
        [ -d "$GIT_DIR_NEW" ] && fatal "'$GIT_DIR_NEW' exists" 54
@@ -328,7 +357,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'