Skip to content
Snippets Groups Projects
Commit 5b3fd75c authored by Richard Hartmann's avatar Richard Hartmann
Browse files

Merge tag 'v1.20130829' into debian

Release v1.20130829
parents 04cda2da 0f0a557a
No related branches found
Tags
No related merge requests found
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> Alexander Skurikhin <a.skurihin@gmail.com> <a.skurihin@gmail.com>
...@@ -5,7 +5,7 @@ Thomas Ferris Nicolaisen <tfnico@gmail.com> ...@@ -5,7 +5,7 @@ Thomas Ferris Nicolaisen <tfnico@gmail.com>
martin f. krafft <madduck@madduck.net> martin f. krafft <madduck@madduck.net>
Alessandro Ghedini <alessandro@ghedini.me> Alessandro Ghedini <alessandro@ghedini.me>
Valentin Haenel <valentin.haenel@gmx.de> Valentin Haenel <valentin.haenel@gmx.de>
Richard Hartmann <richih.mailinglist@gmail.com> Richard Hartmann <richih@debian.org>
mek-apelsin <mek@pels.in> mek-apelsin <mek@pels.in>
Dieter Plaetinck <dieter@plaetinck.be> Dieter Plaetinck <dieter@plaetinck.be>
Corey Quinn <corey@sequestered.net> Corey Quinn <corey@sequestered.net>
......
...@@ -3,20 +3,42 @@ vcsh - Version Control System for $HOME - multiple Git repositories in $HOME ...@@ -3,20 +3,42 @@ vcsh - Version Control System for $HOME - multiple Git repositories in $HOME
# Index # Index
1. [Introduction](#introduction) 1. [30 second howto](#30-second-howto)
2. [30 second howto](#30-second-howto) 2. [Introduction](#introduction)
3. [Overview](#overview) 3. [Usage Exmaples](#usage-examples)
4. [Getting Started](#getting-started) 4. [Overview](#overview)
5. [Usage Exmaples](#usage-examples) 5. [Getting Started](#getting-started)
6. [Contact](#contact) 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 # 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 directory. They all maintain their working trees without clobbering each other
or interfering otherwise. By default, all git repositories maintained via 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. `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 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 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 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 ...@@ -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 or available to root and you may want to maintain different configuration for
`ssh` on your personal and your work machines. `ssh` on your personal and your work machines.
`vcsh` was designed with [mr][mr], a tool to manage Multiple Repositories, in A lot of modern UNIX-based systems offer packages for `vcsh`. In case yours
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
does not read `INSTALL.md` for install instructions or `PACKAGING.md` to create 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 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. 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. ...@@ -39,30 +55,59 @@ can give you your own packaging branch in the upstream repository.
## Talks ## Talks
Some people found it useful to look at slides and videos explaining how `vcsh` Some people found it useful to look at slides and videos explaining how `vcsh`
works instead of working through the docs, first. works instead of working through the docs.
They can all be found [on the author's talk page][talks]. 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 There are three different ways to interact with `vcsh` repositories; this
while the explanation of the concepts behind `vcsh` needs to touch a few gory section will only show the simplest and easiest way.
details of `git` internals, getting started with `vcsh` is extremely simple. 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 vcsh init vim
## Clone an existing repository
vcsh clone <remote> <repository_name>
## Add files to repository "vim"
vcsh vim add ~/.vimrc ~/.vim vcsh vim add ~/.vimrc ~/.vim
vcsh vim commit -m 'Initial commit of my Vim configuration' vcsh vim commit -m 'Update Vim configuration'
# optionally push your files to a remote
## Add a remote for repository "vim"
vcsh vim remote add origin <remote> vcsh vim remote add origin <remote>
vcsh vim push -u origin master vcsh vim push origin master:master
# from now on you can push additional commits like this vcsh vim branch --track master origin/master
## Push to remote of repository "vim"
vcsh vim push vcsh vim push
If all that looks a _lot_ like standard `git`, that's no coincidence; it's ## Pull from remote of repository "vim"
a design feature.
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 # Overview
...@@ -93,9 +138,12 @@ To manage both `vcsh` and other repositories, we suggest using [mr](mr). `mr` ...@@ -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 takes care of pulling in and pushing out new data for a variety of version
control systems. 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 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. 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 ...@@ -168,9 +216,6 @@ you to conveniently run `mr up` etc. to manage all repositories. It looks like
this: this:
[DEFAULT] [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/* include = cat ${XDG_CONFIG_HOME:-$HOME/.config}/mr/config.d/*
### repo.d ### repo.d
...@@ -196,10 +241,8 @@ configuration to a new host. ...@@ -196,10 +241,8 @@ configuration to a new host.
example: `vcsh clone git://github.com/RichiH/vcsh_mr_template.git mr` 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 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). you may have already configured by adding symlinks to git).
3. Make sure the line 'include = cat /usr/share/mr/vcsh' in .mrconfig points 3. Run mr to clone the repositories: `cd; mr update`.
to an existing file 4. Done.
4. Run mr to clone the repositories: `cd; mr update`.
5. Done.
Hopefully the above could help explain how this approach saves time by 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 ...@@ -260,18 +303,12 @@ and further documentation about the use of AUR is available
#### From source #### 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 # choose a location for your checkout
cd $HOME
mkdir -p ~/work/git mkdir -p ~/work/git
cd ~/work/git
git clone git://github.com/RichiH/vcsh.git git clone git://github.com/RichiH/vcsh.git
cd vcsh 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 cd
#### Clone the Template #### Clone the Template
...@@ -358,40 +395,6 @@ mr is used to actually retrieve configs, etc ...@@ -358,40 +395,6 @@ mr is used to actually retrieve configs, etc
~ % mr -j 5 up ~ % 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 # mr usage ; will be factored out & rewritten
### Keeping repositories Up-to-Date ### Keeping repositories Up-to-Date
......
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> 2013-07-24 Richard Hartmann <richih.mailinglist@gmail.com>
* Release 1.20130724 * Release 1.20130724
......
...@@ -12,6 +12,8 @@ Available hooks are: ...@@ -12,6 +12,8 @@ Available hooks are:
* post-command * post-command
* pre-enter * pre-enter
* post-enter * post-enter
* pre-init
* post-init
* pre-pull * pre-pull
* post-pull * post-pull
* pre-push * pre-push
......
...@@ -29,7 +29,7 @@ vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME ...@@ -29,7 +29,7 @@ vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME
`vcsh` run <repo> <shell command> `vcsh` run <repo> <shell command>
`vcsh` status `vcsh` status [<repo>]
`vcsh` upgrade <repo> `vcsh` upgrade <repo>
...@@ -86,6 +86,9 @@ an interactive user. ...@@ -86,6 +86,9 @@ an interactive user.
If you need to clone a bundle of repositories, look into the If you need to clone a bundle of repositories, look into the
`post-clone-retired` hook. `post-clone-retired` hook.
* commit:
Commit in all repositories
* delete: * delete:
Delete an existing repository. Delete an existing repository.
...@@ -128,7 +131,7 @@ an interactive user. ...@@ -128,7 +131,7 @@ an interactive user.
an interactive user. an interactive user.
* status: * status:
Show statuses of all vcsh repositories. Show statuses of all/one vcsh repositories.
* upgrade: * upgrade:
Upgrade repository to currently recommended settings. 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 ...@@ -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 same rules as above apply. The dot between the repository's name and the hook
is mandatory, though. is mandatory, though.
Available hooks are <pre-enter>, <post-enter>, <pre-run>, <post-run>, Available hooks are <pre-clone>, <post-clone>, <post-clone-retired>,
<pre-upgrade>, and <post-upgrade>. If you need more, vcsh is trivial to patch, <pre-command>, <post-command>, <pre-enter>, <post-enter>, <pre-init>,
but please let upstream know so we can ship them by default. <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 ## DETAILED HOWTO AND FURTHER READING
...@@ -279,7 +285,7 @@ This manpage and `vcsh` itself were written by Richard "RichiH" Hartmann. ...@@ -279,7 +285,7 @@ This manpage and `vcsh` itself were written by Richard "RichiH" Hartmann.
## COPYRIGHT ## 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. Licensed under the GNU GPL version 2 or higher.
......
#!/bin/sh #!/bin/sh
# This program is licensed under the GNU GPL version 2 or later. # 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 # For details, see LICENSE. To submit patches, you have to agree to
# license your code under the GNU GPL version 2 or later. # license your code under the GNU GPL version 2 or later.
...@@ -24,7 +24,7 @@ basename() { ...@@ -24,7 +24,7 @@ basename() {
} }
SELF=$(basename $0) SELF=$(basename $0)
VERSION='1.20130724' VERSION='1.20130829'
fatal() { fatal() {
echo "$SELF: fatal: $1" >&2 echo "$SELF: fatal: $1" >&2
...@@ -38,9 +38,11 @@ while getopts "c:dv" flag; do ...@@ -38,9 +38,11 @@ while getopts "c:dv" flag; do
if [ "$1" = '-d' ] || [ "$1" = '--debug' ]; then if [ "$1" = '-d' ] || [ "$1" = '--debug' ]; then
set -vx set -vx
VCSH_DEBUG=1 VCSH_DEBUG=1
echo "debug mode on"
echo "$SELF $VERSION" echo "$SELF $VERSION"
elif [ "$1" = '-v' ];then elif [ "$1" = '-v' ];then
VCSH_VERBOSE=1 VCSH_VERBOSE=1
echo "verbose mode on"
echo "$SELF $VERSION" echo "$SELF $VERSION"
elif [ "$1" = '-c' ];then elif [ "$1" = '-c' ];then
VCSH_OPTION_CONFIG=$OPTARG VCSH_OPTION_CONFIG=$OPTARG
...@@ -92,6 +94,7 @@ help() { ...@@ -92,6 +94,7 @@ help() {
commands: commands:
clone <remote> \\ clone <remote> \\
[<repo>] Clone from an existing repository [<repo>] Clone from an existing repository
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
help Display this help text help Display this help text
...@@ -106,7 +109,7 @@ help() { ...@@ -106,7 +109,7 @@ help() {
<newname> Rename repository <newname> Rename repository
run <repo> \\ run <repo> \\
<command> Use this repository <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 upgrade <repo> Upgrade repository to currently recommended settings
version Print version information version Print version information
which <substring> Find substring in name of any tracked file which <substring> Find substring in name of any tracked file
...@@ -158,6 +161,18 @@ clone() { ...@@ -158,6 +161,18 @@ clone() {
hook post-clone-retired 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() { delete() {
cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11 cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11
use use
...@@ -197,12 +212,14 @@ hook() { ...@@ -197,12 +212,14 @@ hook() {
} }
init() { init() {
hook pre-init
[ ! -e "$GIT_DIR" ] || fatal "'$GIT_DIR' exists" 10 [ ! -e "$GIT_DIR" ] || fatal "'$GIT_DIR' exists" 10
export GIT_WORK_TREE="$VCSH_BASE" export GIT_WORK_TREE="$VCSH_BASE"
mkdir -p "$GIT_WORK_TREE" || fatal "could not create '$GIT_WORK_TREE'" 50 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 cd "$GIT_WORK_TREE" || fatal "could not enter '$GIT_WORK_TREE'" 11
git init git init
upgrade upgrade
hook post-init
} }
list() { list() {
...@@ -277,6 +294,11 @@ run() { ...@@ -277,6 +294,11 @@ run() {
} }
status() { status() {
if [ ! "x$VCSH_REPO_NAME" = "x" ]; then
export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
use
git status --short --untracked-files='no'
else
for VCSH_REPO_NAME in $(list); do for VCSH_REPO_NAME in $(list); do
echo "$VCSH_REPO_NAME:" echo "$VCSH_REPO_NAME:"
export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git" export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
...@@ -284,6 +306,7 @@ status() { ...@@ -284,6 +306,7 @@ status() {
git status --short --untracked-files='no' git status --short --untracked-files='no'
echo echo
done done
fi
} }
upgrade() { upgrade() {
...@@ -383,12 +406,15 @@ elif [ "$1" = 'delete' ] || ...@@ -383,12 +406,15 @@ elif [ "$1" = 'delete' ] ||
[ "$VCSH_COMMAND" = 'rename' ] && { export VCSH_REPO_NAME_NEW="$3"; [ "$VCSH_COMMAND" = 'rename' ] && { export VCSH_REPO_NAME_NEW="$3";
export GIT_DIR_NEW="$VCSH_REPO_D/$VCSH_REPO_NAME_NEW.git"; } export GIT_DIR_NEW="$VCSH_REPO_D/$VCSH_REPO_NAME_NEW.git"; }
[ "$VCSH_COMMAND" = 'run' ] && shift 2 [ "$VCSH_COMMAND" = 'run' ] && shift 2
elif [ "$1" = 'list' ] || elif [ "$1" = 'commit' ] ||
[ "$1" = 'list' ] ||
[ "$1" = 'list-tracked' ] || [ "$1" = 'list-tracked' ] ||
[ "$1" = 'pull' ] || [ "$1" = 'pull' ] ||
[ "$1" = 'push' ] || [ "$1" = 'push' ]; then
[ "$1" = 'status' ]; then export VCSH_COMMAND="$1"
elif [ "$1" = 'status' ]; then
export VCSH_COMMAND="$1" export VCSH_COMMAND="$1"
export VCSH_REPO_NAME="$2"
elif [ -n "$2" ]; then elif [ -n "$2" ]; then
export VCSH_COMMAND='run' export VCSH_COMMAND='run'
export VCSH_REPO_NAME="$1" export VCSH_REPO_NAME="$1"
...@@ -419,7 +445,7 @@ check_dir() { ...@@ -419,7 +445,7 @@ check_dir() {
if [ -e "$check_directory" ]; then if [ -e "$check_directory" ]; then
fatal "'$check_directory' exists but is not a directory" 13 fatal "'$check_directory' exists but is not a directory" 13
else else
info "attempting to create '$check_directory'" verbose "attempting to create '$check_directory'"
mkdir -p "$check_directory" || fatal "could not create '$check_directory'" 50 mkdir -p "$check_directory" || fatal "could not create '$check_directory'" 50
fi fi
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment