On Mon, Mar 30, 2015 at 7:11 AM, Richard Hartmann
<richih.mailingl...@gmail.com> wrote:
> I can't merge until I am back from China, though. I usually take a
> mostly-blank laptop with me when travelling abroad for professionally
> paranoid reasons.

Had some free time, please test the attached patch.


Richard
From 00e3e4ee67e7724e8b90f32abc67c05ac37720b7 Mon Sep 17 00:00:00 2001
From: Richard Hartmann <ric...@debian.org>
Date: Fri, 3 Apr 2015 19:36:10 +0200
Subject: [PATCH] vcsh: Implement skeleton of `vcsh foreach`

No help, completion, or other related updates
---
 vcsh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/vcsh b/vcsh
index 0f2c5af..a5c3f48 100755
--- a/vcsh
+++ b/vcsh
@@ -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' ] ||
-- 
2.1.4

_______________________________________________
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home

Reply via email to