Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vcsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Lyda
vcsh
Commits
84136a71
Commit
84136a71
authored
Dec 19, 2015
by
Richard Hartmann
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/foreach'
parents
29b6c287
2cc7ffcd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
_vcsh
+5
-0
5 additions, 0 deletions
_vcsh
doc/vcsh.1.ronn
+7
-0
7 additions, 0 deletions
doc/vcsh.1.ronn
vcsh
+26
-0
26 additions, 0 deletions
vcsh
with
38 additions
and
0 deletions
_vcsh
+
5
−
0
View file @
84136a71
...
@@ -23,6 +23,10 @@ function _vcsh-enter () {
...
@@ -23,6 +23,10 @@ function _vcsh-enter () {
((
CURRENT
==
2
))
&&
__vcsh_repositories
((
CURRENT
==
2
))
&&
__vcsh_repositories
}
}
function
_vcsh-foreach
()
{
_dispatch git git
}
function
_vcsh-help
()
{
function
_vcsh-help
()
{
_nothing
_nothing
}
}
...
@@ -96,6 +100,7 @@ function _vcsh () {
...
@@ -96,6 +100,7 @@ function _vcsh () {
"commit:commit in all repositories"
"commit:commit in all repositories"
"delete:delete an existing repository"
"delete:delete an existing repository"
"enter:enter repository; spawn new <
\$
SHELL>"
"enter:enter repository; spawn new <
\$
SHELL>"
"foreach:execute for all repos"
"help:display help"
"help:display help"
"init:initialize an empty repository"
"init:initialize an empty repository"
"list:list all local vcsh repositories"
"list:list all local vcsh repositories"
...
...
This diff is collapsed.
Click to expand it.
doc/vcsh.1.ronn
+
7
−
0
View file @
84136a71
...
@@ -11,6 +11,8 @@ vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME
...
@@ -11,6 +11,8 @@ vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME
`vcsh` enter <repo>
`vcsh` enter <repo>
`vcsh` foreach [-g] <git command>
`vcsh` help
`vcsh` help
`vcsh` init <repo>
`vcsh` init <repo>
...
@@ -98,6 +100,11 @@ an interactive user.
...
@@ -98,6 +100,11 @@ an interactive user.
* enter:
* enter:
Enter repository; spawn new <$SHELL>.
Enter repository; spawn new <$SHELL>.
* foreach:
Execute git command for every vcsh repository.
`-g`: Execute in general context.
* help:
* help:
Display help.
Display help.
...
...
This diff is collapsed.
Click to expand it.
vcsh
+
26
−
0
View file @
84136a71
...
@@ -106,6 +106,8 @@ help() {
...
@@ -106,6 +106,8 @@ help() {
commit Commit in all repositories
commit Commit in all repositories
delete <repo> Delete an existing repository
delete <repo> Delete an existing repository
enter <repo> Enter repository; spawn new instance of
\$
SHELL
enter <repo> Enter repository; spawn new instance of
\$
SHELL
foreach [<-g>]
<git command> Execute a command for every repository
help Display this help text
help Display this help text
init <repo> Initialize a new repository
init <repo> Initialize a new repository
list List all repositories
list List all repositories
...
@@ -216,6 +218,27 @@ enter() {
...
@@ -216,6 +218,27 @@ enter() {
hook post-enter
hook post-enter
}
}
foreach
()
{
hook pre-foreach
# We default to prefixing `git` to all commands passed to foreach, but
# allow running in general context with -g
command_prefix
=
git
while
getopts
"g"
flag
;
do
if
[
x
"
$1
"
=
x
'-g'
]
;
then
unset
command_prefix
fi
shift
1
done
for
VCSH_REPO_NAME
in
$(
list
)
;
do
echo
"
$VCSH_REPO_NAME
:"
GIT_DIR
=
$VCSH_REPO_D
/
$VCSH_REPO_NAME
.git
;
export
GIT_DIR
use
$command_prefix
"
$@
"
done
hook post-foreach
}
git_dir_exists
()
{
git_dir_exists
()
{
[
-d
"
$GIT_DIR
"
]
||
fatal
"no repository found for '
$VCSH_REPO_NAME
'"
12
[
-d
"
$GIT_DIR
"
]
||
fatal
"no repository found for '
$VCSH_REPO_NAME
'"
12
}
}
...
@@ -558,6 +581,9 @@ elif [ x"$VCSH_COMMAND" = x'delete' ] ||
...
@@ -558,6 +581,9 @@ elif [ x"$VCSH_COMMAND" = x'delete' ] ||
[
x
"
$VCSH_COMMAND
"
=
x
'rename'
]
&&
{
VCSH_REPO_NAME_NEW
=
$3
;
export
VCSH_REPO_NAME_NEW
;
[
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
;
}
GIT_DIR_NEW
=
$VCSH_REPO_D
/
$VCSH_REPO_NAME_NEW
.git
;
export
GIT_DIR_NEW
;
}
[
x
"
$VCSH_COMMAND
"
=
x
'run'
]
&&
shift
2
[
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'
]
||
elif
[
x
"
$VCSH_COMMAND
"
=
x
'commit'
]
||
[
x
"
$VCSH_COMMAND
"
=
x
'list'
]
||
[
x
"
$VCSH_COMMAND
"
=
x
'list'
]
||
[
x
"
$VCSH_COMMAND
"
=
x
'list-tracked'
]
||
[
x
"
$VCSH_COMMAND
"
=
x
'list-tracked'
]
||
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment