Eric Bouchut <ebouchut@gmail.com>
Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
+Rob Cornish <jrmcornish@gmail.com>
Vincent Demeester <vincent@demeester.fr>
Thomas Ferris Nicolaisen <tfnico@gmail.com>
martin f. krafft <madduck@madduck.net>
Alessandro Ghedini <alessandro@ghedini.me>
+Mikhail Gusarov <dottedmag@dottedmag.net>
Valentin Haenel <valentin.haenel@gmx.de>
Richard Hartmann <richih@debian.org>
Gregor Jasny <gjasny@googlemail.com>
Caleb Maclennan <caleb@alerque.com>
+Markus Martin <markus@archwyrm.net>
mek-apelsin <mek@pels.in>
Evan Pitstick <nerdx00@gmail.com>
Dieter Plaetinck <dieter@plaetinck.be>
Corey Quinn <corey@sequestered.net>
+Pavlos Ratis <dastergon@gentoo.org>
Gernot Schulz <post@gernot-schulz.com>
Alexander Skurikhin <a.skurihin@gmail.com>
Jonathan Sternberg <jonathansternberg@gmail.com>
Frank Terbeck <ft@bewatermyfriend.org>
+Aaron VonderHaar <gruen0aermel@gmail.com>
+Tony <zearin@gonk.net>
`vcsh enter` and `vcsh run` will be covered in later sections.
-## Initialize a new repository called "vim"
+| Task | Command |
+| ----------------------------------------------------- | ------------------------------------------------- |
+| _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 '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` |
+| _Show status of changed files in all repositories_ | `vcsh status` |
+| _Pull from all repositories_ | `vcsh pull` |
+| _Push to all repositories_ | `vcsh push` |
- 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
-
-## Show status of changed files in all repositories
-
- vcsh status
-
-## Pull from all repositories
-
- vcsh pull
-
-## Push to all repositories
-
- vcsh push
# Overview
apt-get install mr
-#### Install vcsh
+### Install vcsh
#### Debian
-If you are using Debian Squeeze, you will need to enable backports
+If you are using Debian Squeeze, you will need to enable backports.
+From Wheezy onwards, you can install it directly:
apt-get install vcsh
+#### Gentoo
+
+To install vcsh in Gentoo Linux just give the following command as root:
+
+ emerge dev-vcs/vcsh
+
#### Arch Linux
vcsh is availabe via [AUR](https://aur.archlinux.org/packages.php?ID=54164)
# This should always be the first line of code to facilitate debugging
[ -n "$VCSH_DEBUG" ] && set -vx
+
+# If '.git-HEAD' is appended to the version, you are seeing an unreleased
+# version of vcsh; the master branch is supposed to be clean at all times
+# so you can most likely just use it nonetheless
+VERSION='1.20131229.git-HEAD'
SELF=$(basename $0)
-VERSION='1.20131214.git-HEAD'
fatal() {
echo "$SELF: fatal: $1" >&2
VCSH_DEBUG=1
echo "debug mode on"
echo "$SELF $VERSION"
- elif [ "$1" = '-v' ];then
+ elif [ "$1" = '-v' ]; then
VCSH_VERBOSE=1
echo "verbose mode on"
echo "$SELF $VERSION"
- elif [ "$1" = '-c' ];then
+ elif [ "$1" = '-c' ]; then
VCSH_OPTION_CONFIG=$OPTARG
fi
shift 1
# Read configuration and set defaults if anything's not set
[ -n "$VCSH_DEBUG" ] && set -vx
-[ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config"
+: ${XDG_CONFIG_HOME:=$HOME/.config}
# Read configuration files if there are any
[ -r "/etc/vcsh/config" ] && . "/etc/vcsh/config"
[ -n "$VCSH_DEBUG" ] && set -vx
# Read defaults
-[ -z "$VCSH_REPO_D" ] && VCSH_REPO_D="$XDG_CONFIG_HOME/vcsh/repo.d"
-[ -z "$VCSH_HOOK_D" ] && VCSH_HOOK_D="$XDG_CONFIG_HOME/vcsh/hooks-enabled"
-[ -z "$VCSH_BASE" ] && VCSH_BASE="$HOME"
-[ -z "$VCSH_GITIGNORE" ] && VCSH_GITIGNORE='exact'
-[ -z "$VCSH_WORKTREE" ] && VCSH_WORKTREE='absolute'
+: ${VCSH_REPO_D:=$XDG_CONFIG_HOME/vcsh/repo.d}
+: ${VCSH_HOOK_D:=$XDH_CONFIG_HOME/vcsh/hooks-enabled}
+: ${VCSH_BASE:=$HOME}
+: ${VCSH_GITIGNORE:=exact}
+: ${VCSH_WORKTREE:=absolute}
if [ ! "x$VCSH_GITIGNORE" = 'xexact' ] && [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && [ ! "x$VCSH_GITIGNORE" = 'xrecursive' ]; then
fatal "'\$VCSH_GITIGNORE' must equal 'exact', 'none', or 'recursive'" 1
pull() {
hook pre-pull
for VCSH_REPO_NAME in $(list); do
- echo -n "$VCSH_REPO_NAME: "
+ printf "$VCSH_REPO_NAME: "
export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
use
git pull
push() {
hook pre-push
for VCSH_REPO_NAME in $(list); do
- echo -n "$VCSH_REPO_NAME: "
+ printf "$VCSH_REPO_NAME: "
export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
use
git push
done | sort -u)
# Contrary to GNU mktemp, mktemp on BSD/OSX requires a template for temp files
- # Use the template GNU mktemo defaults to
- tempfile=$(mktemp tmp.XXXXXXXXXX) || fatal "could not create tempfile" 51
+ # Using a template makes GNU mktemp default to $PWD and not #TMPDIR for tempfile location
+ # To make every OS happy, set full path explicitly
+ tempfile=$(mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX") || fatal "could not create tempfile: '${tempfile}'" 51
echo '*' > "$tempfile" || fatal "could not write to '$tempfile'" 57
for gitignore in $gitignores; do
export VCSH_COMMAND="$1"
-[ "$VCSH_COMMAND" = 'clon' ] || [ "$VCSH_COMMAND" = 'clo' ] || [ "$VCSH_COMMAND" = 'cl' ] && VCSH_COMMAND='clone'
-[ "$VCSH_COMMAND" = 'commi' ] || [ "$VCSH_COMMAND" = 'comm' ] || [ "$VCSH_COMMAND" = 'com' ] || [ "$VCSH_COMMAND" = 'co' ] && VCSH_COMMAND='commit'
-[ "$VCSH_COMMAND" = 'delet' ] || [ "$VCSH_COMMAND" = 'dele' ] || [ "$VCSH_COMMAND" = 'del' ] || [ "$VCSH_COMMAND" = 'de' ] && VCSH_COMMAND='delete'
-[ "$VCSH_COMMAND" = 'ente' ] || [ "$VCSH_COMMAND" = 'ent' ] || [ "$VCSH_COMMAND" = 'en' ] && VCSH_COMMAND='enter'
-[ "$VCSH_COMMAND" = 'hel' ] || [ "$VCSH_COMMAND" = 'he' ] && VCSH_COMMAND='help'
-[ "$VCSH_COMMAND" = 'ini' ] || [ "$VCSH_COMMAND" = 'in' ] && VCSH_COMMAND='init'
-[ "$VCSH_COMMAND" = 'pul' ] && VCSH_COMMAND='pull'
-[ "$VCSH_COMMAND" = 'pus' ] && VCSH_COMMAND='push'
-[ "$VCSH_COMMAND" = 'renam' ] || [ "$VCSH_COMMAND" = 'rena' ] || [ "$VCSH_COMMAND" = 'ren' ] || [ "$VCSH_COMMAND" = 're' ] && VCSH_COMMAND='rename'
-[ "$VCSH_COMMAND" = 'ru' ] && VCSH_COMMAND='run'
-[ "$VCSH_COMMAND" = 'statu' ] || [ "$VCSH_COMMAND" = 'stat' ] || [ "$VCSH_COMMAND" = 'sta' ] || [ "$VCSH_COMMAND" = 'st' ] && VCSH_COMMAND='status'
-[ "$VCSH_COMMAND" = 'upgrad' ] || [ "$VCSH_COMMAND" = 'upgra' ] || [ "$VCSH_COMMAND" = 'upgr' ] || [ "$VCSH_COMMAND" = 'upg' ] && VCSH_COMMAND='upgrade'
-[ "$VCSH_COMMAND" = 'versio' ] || [ "$VCSH_COMMAND" = 'versi' ] || [ "$VCSH_COMMAND" = 'vers' ] || [ "$VCSH_COMMAND" = 'ver' ] || [ "$VCSH_COMMAND" = 've' ] && VCSH_COMMAND='version'
-[ "$VCSH_COMMAND" = 'whic' ] || [ "$VCSH_COMMAND" = 'whi' ] || [ "$VCSH_COMMAND" = 'wh' ] && VCSH_COMMAND='which'
-[ "$VCSH_COMMAND" = 'write' ] || [ "$VCSH_COMMAND" = 'writ' ] || [ "$VCSH_COMMAND" = 'wri' ] || [ "$VCSH_COMMAND" = 'wr' ] && VCSH_COMMAND='write-gitignore'
-
+case "$VCSH_COMMAND" in
+ clon|clo|cl) VCSH_COMMAND=clone;;
+ commi|comm|com|co) VCSH_COMMAND=commit;;
+ delet|dele|del|de) VCSH_COMMAND=delete;;
+ ente|ent|en) VCSH_COMMAND=enter;;
+ hel|he) VCSH_COMMAND=help;;
+ ini|in) VCSH_COMMAND=init;;
+ pul) VCSH_COMMAND=pull;;
+ pus) VCSH_COMMAND=push;;
+ renam|rena|ren|re) VCSH_COMMAND=rename;;
+ ru) VCSH_COMMAND=run;;
+ statu|stat|sta|st) VCSH_COMMAND=status;;
+ upgrad|upgra|upgr|up) VCSH_COMMAND=upgrade;;
+ versio|versi|vers|ver|ve) VCSH_COMMAND=version;;
+ which|whi|wh) VCSH_COMMAND=which;;
+ write|writ|wri|wr) VCSH_COMMAND=write-gitignore;;
+esac
if [ "$VCSH_COMMAND" = 'clone' ]; then
[ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a remote" 1