diff --git a/.mailmap b/.mailmap
index 1e66b4db2c319380410828aa4a5e91530e4775c3..5c4d110333efc155fbbe94b905a3f3baa3de0c92 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1,2 +1,3 @@
-Richard Hartmann <richih.mailinglist@gmail.com> <richih+github.com@richih.org>
+Richard Hartmann <richih@debian.org> <richih+github.com@richih.org>
+Richard Hartmann <richih@debian.org> <richih.mailinglist@gmail.com>
Alexander Skurikhin <a.skurihin@gmail.com> <a.skurihin@gmail.com>
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index abea9e09c8fa72f4120dd75aa764ac3fcecdb478..6fc85f0a3c21a3fd9ec229817c9321e3b0857907 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -5,7 +5,7 @@ Thomas Ferris Nicolaisen <tfnico@gmail.com>
martin f. krafft <madduck@madduck.net>
Alessandro Ghedini <alessandro@ghedini.me>
Valentin Haenel <valentin.haenel@gmx.de>
-Richard Hartmann <richih.mailinglist@gmail.com>
+Richard Hartmann <richih@debian.org>
mek-apelsin <mek@pels.in>
Dieter Plaetinck <dieter@plaetinck.be>
Corey Quinn <corey@sequestered.net>
diff --git a/README.md b/README.md
index a83325d979ee4482a828111802d7882a4dbe141c..e0f78375672f506cf12114218822269b367cb66a 100644
--- a/README.md
+++ b/README.md
@@ -3,20 +3,42 @@ vcsh - Version Control System for $HOME - multiple Git repositories in $HOME
# Index
-1. [Introduction](#introduction)
-2. [30 second howto](#30-second-howto)
-3. [Overview](#overview)
-4. [Getting Started](#getting-started)
-5. [Usage Exmaples](#usage-examples)
+1. [30 second howto](#30-second-howto)
+2. [Introduction](#introduction)
+3. [Usage Exmaples](#usage-examples)
+4. [Overview](#overview)
+5. [Getting Started](#getting-started)
6. [Contact](#contact)
+# 30 second howto
+
+While it may appear that there's an overwhelming amount of documentation and
+while the explanation of the concepts behind `vcsh` needs to touch a few gory
+details of `git` internals, getting started with `vcsh` is extremely simple.
+
+Let's say you want to version control your `vim` configuration:
+
+ vcsh init vim
+ vcsh vim add ~/.vimrc ~/.vim
+ vcsh vim commit -m 'Initial commit of my Vim configuration'
+ # optionally push your files to a remote
+ vcsh vim remote add origin <remote>
+ vcsh vim push -u origin master
+ # from now on you can push additional commits like this
+ vcsh vim push
+
+If all that looks a _lot_ like standard `git`, that's no coincidence; it's
+a design feature.
+
+
# Introduction
-[vcsh][vcsh] allows you to maintain several git repositories in one single
+[vcsh][vcsh] allows you to maintain several Git repositories in one single
directory. They all maintain their working trees without clobbering each other
-or interfering otherwise. By default, all git repositories maintained via
-`vcsh` are stored in `$HOME` but you can override this setting if you want to.
+or interfering otherwise. By default, all Git repositories maintained via
+`vcsh` store the actual files in `$HOME` but you can override this setting if
+you want to.
All this means that you can have one repository per application or application
family, i.e. `zsh`, `vim`, `ssh`, etc. This, in turn, allows you to clone
custom sets of configurations onto different machines or even for different
@@ -25,13 +47,7 @@ For example, you may not need to have your `mplayer` configuration on a server
or available to root and you may want to maintain different configuration for
`ssh` on your personal and your work machines.
-`vcsh` was designed with [mr][mr], a tool to manage Multiple Repositories, in
-mind and the two integrate very nicely. `mr` has native support for `vcsh`
-repositories and to `vcsh`, `mr` is just another configuration to track.
-This make setting up any new machine a breeze. It takes literally less than
-five minutes to go from standard installation to fully set up system
-
-A lot of modern UNIX-based systems offer pacakges for `vcsh`. In case yours
+A lot of modern UNIX-based systems offer packages for `vcsh`. In case yours
does not read `INSTALL.md` for install instructions or `PACKAGING.md` to create
a package, yourself. If you do end up packaging `vcsh` please let us know so we
can give you your own packaging branch in the upstream repository.
@@ -39,30 +55,59 @@ can give you your own packaging branch in the upstream repository.
## Talks
Some people found it useful to look at slides and videos explaining how `vcsh`
-works instead of working through the docs, first.
-They can all be found [on the author's talk page][talks].
+works instead of working through the docs.
+All slides, videos, and further information can be found
+[on the author's talk page][talks].
-# 30 second howto
+# Usage Examples
-While it may appear that there's an overwhelming amount of documentation and
-while the explanation of the concepts behind `vcsh` needs to touch a few gory
-details of `git` internals, getting started with `vcsh` is extremely simple.
+There are three different ways to interact with `vcsh` repositories; this
+section will only show the simplest and easiest way.
+Certain more advanced use cases require the other two ways, but don't worry
+about this for now. If you never even bother playing with the other two
+modes you will still be fine.
+`vcsh enter` and `vcsh run` will be covered in later sections.
-Let's say you want to version control your `vim` configuration:
+
+## Initialize a new repository called "vim"
vcsh init vim
+
+## Clone an existing repository
+
+ vcsh clone <remote> <repository_name>
+
+## Add files to repository "vim"
+
vcsh vim add ~/.vimrc ~/.vim
- vcsh vim commit -m 'Initial commit of my Vim configuration'
- # optionally push your files to a remote
+ vcsh vim commit -m 'Update Vim configuration'
+
+## Add a remote for repository "vim"
+
vcsh vim remote add origin <remote>
- vcsh vim push -u origin master
- # from now on you can push additional commits like this
+ vcsh vim push origin master:master
+ vcsh vim branch --track master origin/master
+
+## Push to remote of repository "vim"
+
vcsh vim push
-If all that looks a _lot_ like standard `git`, that's no coincidence; it's
-a design feature.
+## Pull from remote of repository "vim"
+
+ vcsh vim pull
+## Show status of changed files in all repositories
+
+ vcsh status
+
+## Pull from all repositories
+
+ vcsh pull
+
+## Push to all repositories
+
+ vcsh push
# Overview
@@ -93,9 +138,12 @@ To manage both `vcsh` and other repositories, we suggest using [mr](mr). `mr`
takes care of pulling in and pushing out new data for a variety of version
control systems.
+`vcsh` was designed with [mr][mr], a tool to manage Multiple Repositories, in
+mind and the two integrate very nicely. `mr` has native support for `vcsh`
+repositories and to `vcsh`, `mr` is just another configuration to track.
+This make setting up any new machine a breeze. It takes literally less than
+five minutes to go from standard installation to fully set up system
-The last logical step is to maintain all those new repositores with an automated
-tool instead of tracking them by hand.
This is where `mr` comes in. While the use of `mr` is technically
optional, but it will be an integral part of the proposed system that follows.
@@ -168,9 +216,6 @@ you to conveniently run `mr up` etc. to manage all repositories. It looks like
this:
[DEFAULT]
- jobs = 5
- # Use if your mr does not have vcsh support in mainline, yet
- include = cat /usr/share/mr/vcsh
include = cat ${XDG_CONFIG_HOME:-$HOME/.config}/mr/config.d/*
### repo.d
@@ -196,10 +241,8 @@ configuration to a new host.
example: `vcsh clone git://github.com/RichiH/vcsh_mr_template.git mr`
2. Choose your repositories by linking them in config.d (or go with the default
you may have already configured by adding symlinks to git).
-3. Make sure the line 'include = cat /usr/share/mr/vcsh' in .mrconfig points
- to an existing file
-4. Run mr to clone the repositories: `cd; mr update`.
-5. Done.
+3. Run mr to clone the repositories: `cd; mr update`.
+4. Done.
Hopefully the above could help explain how this approach saves time by
@@ -260,18 +303,12 @@ and further documentation about the use of AUR is available
#### From source
-If your version of mr is older than version 1.07, make sure to put
-
- include = cat /usr/share/mr/vcsh
-
-into your .mrconfig .
-
# choose a location for your checkout
- cd $HOME
mkdir -p ~/work/git
+ cd ~/work/git
git clone git://github.com/RichiH/vcsh.git
cd vcsh
- ln -s vcsh /usr/local/bin # or add it to your PATH
+ sudo ln -s vcsh /usr/local/bin # or add it to your PATH
cd
#### Clone the Template
@@ -358,40 +395,6 @@ mr is used to actually retrieve configs, etc
~ % mr -j 5 up
-# Usage Examples
-
-All examples in this section will use the short form of `vcsh` which is the
-simplest way to interface with it. If you don't know what that means simply
-ignore this fact for now and follow the examples.
-
-## Initialize a new repository "vim"
-
- vcsh init vim
-
-## Clone an existing repository
-
- vcsh clone <remote> <repository_name>
-
-## Add files to repository "vim"
-
- vcsh vim add ~/.vimrc ~/.vim
- vcsh vim commit -m 'Update Vim configuration'
-
-## Add a remote for repository "vim"
-
- vcsh vim remote add origin <remote>
- vcsh vim push origin master:master
- vcsh vim branch --track master origin/master
-
-## Push to remote of repository "vim"
-
- vcsh vim push
-
-## Pull from remote of repository "vim"
-
- vcsh vim pull
-
-
# mr usage ; will be factored out & rewritten
### Keeping repositories Up-to-Date
diff --git a/changelog b/changelog
index 1f1d1e647aacb3f846147e0326fea449a729f682..564ccbb22ec659db975b34f76a103bbc9e952592 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,12 @@
+2013-08-29 Richard Hartmann <richih.mailinglist@gmail.com>
+
+ * Release 1.20130829
+ * Add support for `vcsh commit`
+ * Add support for `vcsh status <repo>`
+ * Add pre-/post-init hooks
+ * Documentation improvements
+ * Minor cleanups
+
2013-07-24 Richard Hartmann <richih.mailinglist@gmail.com>
* Release 1.20130724
diff --git a/doc/hooks b/doc/hooks
index 3c72ef88e336f6eb8f109a6871aa7f2068eee469..54ff795611c0081e11eca8d16064f0f57f2ac60e 100644
--- a/doc/hooks
+++ b/doc/hooks
@@ -12,6 +12,8 @@ Available hooks are:
* post-command
* pre-enter
* post-enter
+* pre-init
+* post-init
* pre-pull
* post-pull
* pre-push
diff --git a/doc/vcsh.1.ronn b/doc/vcsh.1.ronn
index 9532e654278c1187eb0112b8d50769ed19156eea..89ebff5a161a60eb8a1b2857259392a7addf1133 100644
--- a/doc/vcsh.1.ronn
+++ b/doc/vcsh.1.ronn
@@ -29,7 +29,7 @@ vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME
`vcsh` run <repo> <shell command>
-`vcsh` status
+`vcsh` status [<repo>]
`vcsh` upgrade <repo>
@@ -86,6 +86,9 @@ an interactive user.
If you need to clone a bundle of repositories, look into the
`post-clone-retired` hook.
+* commit:
+ Commit in all repositories
+
* delete:
Delete an existing repository.
@@ -128,7 +131,7 @@ an interactive user.
an interactive user.
* status:
- Show statuses of all vcsh repositories.
+ Show statuses of all/one vcsh repositories.
* upgrade:
Upgrade repository to currently recommended settings.
@@ -226,9 +229,12 @@ the repository's name, followed by a dot, i.e. <zsh.pre-run>. Otherwise, the
same rules as above apply. The dot between the repository's name and the hook
is mandatory, though.
-Available hooks are <pre-enter>, <post-enter>, <pre-run>, <post-run>,
-<pre-upgrade>, and <post-upgrade>. If you need more, vcsh is trivial to patch,
-but please let upstream know so we can ship them by default.
+Available hooks are <pre-clone>, <post-clone>, <post-clone-retired>,
+<pre-command>, <post-command>, <pre-enter>, <post-enter>, <pre-init>,
+<post-init>, <pre-pull>, <post-pull>, <pre-push>, <post-push>, <pre-run>,
+<post-run>, <pre-upgrade>, and <post-upgrade>.
+If you need more, vcsh is trivial to patch, but please let upstream know so
+we can ship them by default.
## DETAILED HOWTO AND FURTHER READING
@@ -279,7 +285,7 @@ This manpage and `vcsh` itself were written by Richard "RichiH" Hartmann.
## COPYRIGHT
-Copyright 2011-2013 Richard Hartmann <richih.mailinglist@gmail.com>
+Copyright 2011-2013 Richard Hartmann <richih@debian.org>
Licensed under the GNU GPL version 2 or higher.
diff --git a/vcsh b/vcsh
index f2bbd7a229c8211b9d79cb3bb0ee262f54a28eec..2ec49557b39b6d00d39d37eb70762d7fe5956538 100755
--- a/vcsh
+++ b/vcsh
@@ -1,7 +1,7 @@
#!/bin/sh
# This program is licensed under the GNU GPL version 2 or later.
-# (c) Richard "RichiH" Hartmann <richih.mailinglist@gmail.com>, 2011-2013
+# (c) Richard "RichiH" Hartmann <richih@debian.org>, 2011-2013
# For details, see LICENSE. To submit patches, you have to agree to
# license your code under the GNU GPL version 2 or later.
@@ -24,7 +24,7 @@ basename() {
}
SELF=$(basename $0)
-VERSION='1.20130724'
+VERSION='1.20130829'
fatal() {
echo "$SELF: fatal: $1" >&2
@@ -38,9 +38,11 @@ while getopts "c:dv" flag; do
if [ "$1" = '-d' ] || [ "$1" = '--debug' ]; then
set -vx
VCSH_DEBUG=1
+ echo "debug mode on"
echo "$SELF $VERSION"
elif [ "$1" = '-v' ];then
VCSH_VERBOSE=1
+ echo "verbose mode on"
echo "$SELF $VERSION"
elif [ "$1" = '-c' ];then
VCSH_OPTION_CONFIG=$OPTARG
@@ -92,6 +94,7 @@ help() {
commands:
clone <remote> \\
[<repo>] Clone from an existing repository
+ commit Commit in all repositories
delete <repo> Delete an existing repository
enter <repo> Enter repository; spawn new instance of \$SHELL
help Display this help text
@@ -106,7 +109,7 @@ help() {
<newname> Rename repository
run <repo> \\
<command> Use this repository
- status Show statuses of all vcsh repositories
+ status [<repo>] Show statuses of all/one vcsh repositories
upgrade <repo> Upgrade repository to currently recommended settings
version Print version information
which <substring> Find substring in name of any tracked file
@@ -158,6 +161,18 @@ clone() {
hook post-clone-retired
}
+commit() {
+ hook pre-commit
+ for VCSH_REPO_NAME in $(list); do
+ echo "$VCSH_REPO_NAME: "
+ export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
+ use
+ git commit --untracked-files=no --quiet
+ echo
+ done
+ hook post-commit
+}
+
delete() {
cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11
use
@@ -197,12 +212,14 @@ hook() {
}
init() {
+ hook pre-init
[ ! -e "$GIT_DIR" ] || fatal "'$GIT_DIR' exists" 10
export GIT_WORK_TREE="$VCSH_BASE"
mkdir -p "$GIT_WORK_TREE" || fatal "could not create '$GIT_WORK_TREE'" 50
cd "$GIT_WORK_TREE" || fatal "could not enter '$GIT_WORK_TREE'" 11
git init
upgrade
+ hook post-init
}
list() {
@@ -277,13 +294,19 @@ run() {
}
status() {
- for VCSH_REPO_NAME in $(list); do
- echo "$VCSH_REPO_NAME:"
+ if [ ! "x$VCSH_REPO_NAME" = "x" ]; then
export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
use
git status --short --untracked-files='no'
- echo
- done
+ else
+ for VCSH_REPO_NAME in $(list); do
+ echo "$VCSH_REPO_NAME:"
+ export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
+ use
+ git status --short --untracked-files='no'
+ echo
+ done
+ fi
}
upgrade() {
@@ -383,12 +406,15 @@ elif [ "$1" = 'delete' ] ||
[ "$VCSH_COMMAND" = 'rename' ] && { export VCSH_REPO_NAME_NEW="$3";
export GIT_DIR_NEW="$VCSH_REPO_D/$VCSH_REPO_NAME_NEW.git"; }
[ "$VCSH_COMMAND" = 'run' ] && shift 2
-elif [ "$1" = 'list' ] ||
+elif [ "$1" = 'commit' ] ||
+ [ "$1" = 'list' ] ||
[ "$1" = 'list-tracked' ] ||
[ "$1" = 'pull' ] ||
- [ "$1" = 'push' ] ||
- [ "$1" = 'status' ]; then
+ [ "$1" = 'push' ]; then
+ export VCSH_COMMAND="$1"
+elif [ "$1" = 'status' ]; then
export VCSH_COMMAND="$1"
+ export VCSH_REPO_NAME="$2"
elif [ -n "$2" ]; then
export VCSH_COMMAND='run'
export VCSH_REPO_NAME="$1"
@@ -419,7 +445,7 @@ check_dir() {
if [ -e "$check_directory" ]; then
fatal "'$check_directory' exists but is not a directory" 13
else
- info "attempting to create '$check_directory'"
+ verbose "attempting to create '$check_directory'"
mkdir -p "$check_directory" || fatal "could not create '$check_directory'" 50
fi
fi