automate/020_vcsh.sh

67 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
## vcsh
# When you clone a remote repository foo, vcsh does the following behind the scene:
# 1. create a folder in .config/vcsh/repo.d/foo.git, and export it as GIT_DIR.
# 2. create $VCSH_BASE directory, i.e your home directory by default; and
# export it as GIT_WORK_TREE
# Thus the work tree and git meta data, aka .git folder, are separated.
# We can use git fetch to pull the remote repository into the GIT_DIR, and
# merge the changes back to the GIT_WORK_TREE.
# To see the current remote repository.
# "vcsh mr remote show origin"
# "vcsh mr remote remove origin"
# "vcsh mr remote add origin http://github.com/crazzyfool/mr.git"
# "vcsh mr push --set-upstream origin master"
# These can be aliased in the config file. See below
## mr
# To get started using mr, perhaps you already have some checked out repositories. Go into each one and run
# "mr register".
# Now mr has a list of them in ~/.mrconfig, which you can edit later to tune its operation.
# Suppose you've cd'd to ~/src, and it has many repositories under it. To update them all, run
# "mr update".
# "mr commit". commit any pending changes
# "mr status". check the status of each,
# "mr push". push changes to all repositories.
apt install -y vcsh mr
mkdir -p ~/.config/mr/available.d
mkdir -p ~/.config/mr/config.d
GIT_WORK_TREE=${HOME}
# Change this to your dotfiles repository
GIT_REPO=git://github.com/RichiH/
cat > ~/.config/mr/available.d/mr.vcsh <<EOF
[$HOME/.config/vcsh/repo.d/mr.git]
checkout = vcsh clone ${GIT_REPO}/vcsh_mr_template.git mr
update = vcsh mr pull
push = vcsh mr push
status = vcsh mr status
gc = vcsh mr gc
EOF
cat > ~/.config/mr/available.d/zsh.vcsh <<EOF
[$HOME/.config/vcsh/repo.d/zsh.git]
checkout = vcsh clone ${GIT_REPO}/zshrc.git zsh
EOF
cat > ~/.mrconfig <<EOF
[DEFAULT]
git_gc = git gc "$@"
jobs = 5
include = cat ~/.config/mr/config.d/*
EOF