--- /dev/null
+Alphabetical list of everyone who ever committed to this repository
+
+Vincent Demeester <vincent@demeester.fr>
+Richard Hartmann <richih+github.com@richih.org>
+Richard Hartmann <richih.mailinglist@gmail.com>
+Dieter Plaetinck <dieter@plaetinck.be>
+Corey Quinn <corey@sequestered.net>
+Gernot Schulz <post@gernot-schulz.com>
install -m 0644 $(manpages) $(DESTDIR)$(PREFIX)/share/man/man1
install -d $(DESTDIR)$(PREFIX)/share/doc/vcsh
install -m 0644 README.md $(DESTDIR)$(PREFIX)/share/doc/vcsh
+ install -m 0644 doc/hooks $(DESTDIR)$(PREFIX)/share/doc/vcsh
install -d $(DESTDIR)$(PREFIX)/share/zsh/vendor-completions
install -m 0644 _vcsh $(DESTDIR)$(PREFIX)/share/zsh/vendor-completions
* IRC: #vcs-home on irc.oftc.net
-* Mailing list: vcs-home@lists.madduck.net
+* Mailing list: http://lists.madduck.net/listinfo/vcs-home
* Pull requests or issues on https://github.com/RichiH/vcsh
### available.d ###
-The files you see in $XDG_CONFIG_HOME/mr/available.d are mr configuration files
+The files you see in $XDG\_CONFIG\_HOME/mr/available.d are mr configuration files
that contain the commands to manage (checkout, update etc.) a single
repository. vcsh repo configs end in .vcsh, git configs end in .git, etc. This
is optional and your preference. For example, this is what a zsh.vcsh
### config.d ###
-$XDG_CONFIG_HOME/mr/available.d contains *all available* repositories. Only
+$XDG\_CONFIG\_HOME/mr/available.d contains *all available* repositories. Only
files/links present in mr/config.d, however, will be used by mr. That means
that in this example, only the zsh, gitconfigs, tmux and vim repositories will
be checked out. A simple `mr update` run in $HOME will clone or update those
[DEFAULT]
jobs = 5
- include = cat $XDG_CONFIG_HOME/mr/config.d/*
+ # 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 ###
-$XDG_CONFIG_HOME/vcsh/repo.d is the directory where all git repositories which
+$XDG\_CONFIG\_HOME/vcsh/repo.d is the directory where all git repositories which
are under vcsh's control are located. Since their working trees are configured
to be in $HOME, the files contained in those repositories will be put in $HOME
directly.
configuration to a new host.
1. Clone the mr repository (containing available.d, config.d etc.); for
- example: `vcsh clone git://github.com/RichiH/vcsh_mr_template.git`
+ 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. Run mr to clone the repositories: `cd; mr update`.
-4. Done.
+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.
Hopefully the above could help explain how this approach saves time by
* ~/.gitignore.d
* ~/.mrconfig
-* $XDG_CONFIG_HOME/mr/available.d/mr.vcsh
-* $XDG_CONFIG_HOME/mr/available.d/zsh.vcsh
-* $XDG_CONFIG_HOME/mr/config.d/mr.vcsh
-* $XDG_CONFIG_HOME/vcsh/repo.d/mr.git/
+* $XDG\_CONFIG\_HOME/mr/available.d/mr.vcsh
+* $XDG\_CONFIG\_HOME/mr/available.d/zsh.vcsh
+* $XDG\_CONFIG\_HOME/mr/config.d/mr.vcsh
+* $XDG\_CONFIG\_HOME/vcsh/repo.d/mr.git/
All of the files are part of the template repository, the directory is where
the template will be stored.
#### 4.1.2 Clone the Template ####
+ cd $HOME
mkdir -p ~/work/git
- cd !$
git clone git://github.com/RichiH/vcsh.git vcsh
+ # make sure 'include = cat /usr/share/mr/vcsh' points to an exiting file
+ vim .mrconfig
cd vcsh
- ln -s vcsh /usr/local/bin # or add it to your PATH
+ ln -s vcsh /usr/local/bin # or add it to your PATH
cd
- vcsh clone git://github.com/RichiH/vcsh_mr_template.git mr.vcsh
+ vcsh clone git://github.com/RichiH/vcsh_mr_template.git mr
#### 4.1.3 Enable Your Test Repository ####
You're welcome to clone the example repository:
- vcsh clone git://github.com/RichiH/vcsh_mr_template.git
+ vcsh clone git://github.com/RichiH/vcsh_mr_template.git mr
+ # make sure 'include = cat /usr/share/mr/vcsh' points to an exiting file
+ vim .mrconfig
Look around in the clone. It should be reasonably simple to understand. If not,
poke me, RichiH, on Freenode (query) or OFTC (#vcs-home).
~ % cat ~/.mrconfig
[DEFAULT]
+ # adapt /usr/share/mr/vcsh to your system if needed
+ include = cat /usr/share/mr/vcsh
include = cat $XDG_CONFIG_HOME/mr/config.d/*
~ % echo $XDG_CONFIG_HOME
/home/richih/.config
+++ /dev/null
-# Undecided #
-
-* Have an aborted vcsh clone delete the repo it tried to clone?
--- /dev/null
+Available hooks are:
+pre-enter
+post-enter
+pre-run
+post-run
+pre-setup
+post-setup
`vcsh` setup <repo>
+`vcsh` which <substring>
+
`vcsh` write-gitignore <repo>
`vcsh` <repo> <gitcommand>
vcsh. That being said, you can easily use `vcsh` without `mr` if you prefer.
A sample configuration for `vcsh` and `mr` can be found at
-*https://github.com/RichiH/vcsh_mr_template*
+*https://github.com/RichiH/vcsh_mr_template* and used with `vcsh clone
+https://github.com/RichiH/vcsh_mr_template mr`.
Please note that you can always use a path instead of a name for <repo>.
This is needed to support mr and other scripts properly and of no concern to
* setup:
Set up repository with recommended settings.
+* which <substring>:
+ Find <substring> in name of any tracked file.
+
* write-gitignore:
Write .gitignore.d/<repo> via git ls-files.
* <repo> <gitcommand>:
- Shortcut to run `vcsh` on a repo. Will prepend `git` to <command> by itself.
+ Shortcut to run `vcsh` on a repo. Will prepend `git` to <command>.
* <repo>:
Shortcut to run `vcsh enter <repo>`.
soft-linked into <$XDG_CONFIG_HOME/vcsh/hooks-enabled>; `vcsh` will only
execute hooks that are in this directory.
-Hooks follow a simple format. `pre-run` will be run before anything is run.
+Hooks follow a simple format. <pre-run> will be run before anything is run.
If you want to have more than one script for a certain hook, just append
-any kind of string to order them. A system of `pre-run`, `pre-run.10`,
-`pre-run.20` etc is suggested; other options would be `pre-run-10` or
-`pre-run.sh`. A dot after the hook name is optional.
+any kind of string to order them. A system of <pre-run>, <pre-run.10>,
+<pre-run.20> etc is suggested; other options would be <pre-run-10> or
+<pre-run.sh>. A dot after the hook name is optional.
-If you want to create hooks for a specific `vcsh` repository, simply prepend
-the repository's name, followed by a dot, i.e. `zsh.pre-run`. Otherwise, the
+If you want to create hooks for a specific <vcsh> repository, simply prepend
+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-setup>, and <post-setup>. 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
Man pages are intended to be short and thus often useless to glean best
## COPYRIGHT
-Copyright 2011 Richard Hartmann <richih.mailinglist@gmail.com>
+Copyright 2011-2012 Richard Hartmann <richih.mailinglist@gmail.com>
Licensed under the GNU GPL version 3 or higher.
--- /dev/null
+#!/bin/sh
+
+echo 'Alphabetical list of everyone who ever committed to this repository
+'
+git log --all --format='%an <%ae>' | sort -u -k2
#!/bin/sh
# This program is licensed under the GNU GPL version 2 or later.
-# (c) Richard "RichiH" Hartmann <richih.mailinglist@gmail.com>, 2011
+# (c) Richard "RichiH" Hartmann <richih.mailinglist@gmail.com>, 2011-2012
# For details, see LICENSE. To submit patches, you have to agree to
# license your code under the GNU GPL version 2 or later.
run <repo> \\
<command> Use this repository
setup Set up repository with recommended settings
+ which <substring> Find substring in name of any tracked file
write-gitignore \\
<repo> Write .gitignore.d/<repo> via git ls-files
$files
AGAIN, THIS WILL DELETE YOUR DATA!
-To continue, type \"Yes, do as I say\""
+To continue, type 'Yes, do as I say'"
read answer
- [ "x$answer" = "xYes, do as I say" ] || exit 16
+ [ "x$answer" = 'xYes, do as I say' ] || exit 16
for file in $files; do
rm -f $file || info "could not delete '$file', continuing with deletion"
done
- rmdir "$GIT_DIR" || error "could not delete '$GIT_DIR'"
+ rm -r "$GIT_DIR" || error "could not delete '$GIT_DIR'"
}
enter() {
hook() {
for hook in $VCSH_HOOK_D/$1* $VCSH_HOOK_D/$VCSH_REPO_NAME.$1*; do
[ -x "$hook" ] || continue
+ info "executing '$hook'"
"$hook"
done
}
export VCSH_DIRECTORY="$VCSH_REPO_NAME"
}
+which() {
+ for VCSH_REPO_NAME in $(list); do
+ for VCSH_FILE in $(get_files); do
+ echo $VCSH_FILE | grep -q "$VCSH_COMMAND_PARAMETER" && echo "$VCSH_REPO_NAME: $VCSH_FILE"
+ done
+ done | sort -u
+}
+
write_gitignore() {
use
cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11
fatal "could not move '$tempfile' to '$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME'" 53
}
-if [ ! x$VCSH_GITIGNORE = x'exact' ] && [ ! x$VCSH_GITIGNORE = x'recursive' ]; then
- fatal "\$VCSH_GITIGNORE must be either 'exact' or 'recursive'" 1
+if [ ! "x$VCSH_GITIGNORE" = 'xexact' ] && [ ! "x$VCSH_GITIGNORE" = 'xrecursive' ]; then
+ fatal "'\$VCSH_GITIGNORE' must be either 'exact' or 'recursive'" 1
fi
if [ "$1" = 'clone' ]; then
- [ -z $2 ] && fatal "$1: please specify a remote" 1
+ [ -z "$2" ] && fatal "$1: please specify a remote" 1
export VCSH_COMMAND="$1"
GIT_REMOTE="$2"
[ -n "$3" ] && VCSH_REPO_NAME="$3" || VCSH_REPO_NAME=$(basename "$GIT_REMOTE" .git)
export VCSH_REPO_NAME
export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
-elif [ "$1" = 'delete' ] ||
- [ "$1" = 'enter' ] ||
- [ "$1" = 'init' ] ||
- [ "$1" = 'list-tracked-by' ] ||
- [ "$1" = 'rename' ] ||
- [ "$1" = 'run' ] ||
- [ "$1" = 'setup' ] ||
+elif [ "$1" = 'which' ]; then
+ [ -z "$2" ] && fatal "$1: please specify a filename" 1
+ [ -n "$3" ] && fatal "$1: too many parameters" 1
+ export VCSH_COMMAND="$1"
+ export VCSH_COMMAND_PARAMETER="$2"
+elif [ "$1" = 'delete' ] ||
+ [ "$1" = 'enter' ] ||
+ [ "$1" = 'init' ] ||
+ [ "$1" = 'list-tracked-by' ] ||
+ [ "$1" = 'rename' ] ||
+ [ "$1" = 'run' ] ||
+ [ "$1" = 'setup' ] ||
[ "$1" = 'write-gitignore' ]; then
[ -z $2 ] && fatal "$1: please specify repository to work on" 1
[ "$1" = 'rename' -a -z "$3" ] && fatal "$1: please specify a target name" 1
# Mangle the input to fit normal operation.
if echo $VCSH_REPO_NAME | grep -q '/'; then
export GIT_DIR=$VCSH_REPO_NAME
- export VCSH_REPO_NAME=$(basename $VCSH_REPO_NAME .git)
+ export VCSH_REPO_NAME=$(basename "$VCSH_REPO_NAME" .git)
fi