X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/8f4a012b3bc70e1d33bdba17e5c319c00c829c2a..cfe9984081db05711bd4caa30f435d5eddf4b681:/vcsh?ds=inline

diff --git a/vcsh b/vcsh
index e6b9377..c6257fe 100755
--- a/vcsh
+++ b/vcsh
@@ -101,6 +101,7 @@ help() {
    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> \\
@@ -152,6 +153,8 @@ clone() {
   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
+	retire
+	hook post-clone-retired
 }
 
 delete() {
@@ -234,6 +237,22 @@ pull() {
 	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
@@ -341,7 +360,8 @@ elif [ "$1" = 'delete' ]           ||
 	[ "$VCSH_COMMAND" = 'write-gitignore' ]
 elif [ "$1" = 'list' ] ||
      [ "$1" = 'list-tracked' ] ||
-     [ "$1" = 'pull' ]; then
+     [ "$1" = 'pull' ] ||
+     [ "$1" = 'push' ]; then
 	export VCSH_COMMAND="$1"
 elif [ -n "$2" ]; then
 	export VCSH_COMMAND='run'