Skip to content

Instantly share code, notes, and snippets.

@tribut
Created September 10, 2015 20:35
Show Gist options
  • Save tribut/44c3710db0d8663fc0ed to your computer and use it in GitHub Desktop.
Save tribut/44c3710db0d8663fc0ed to your computer and use it in GitHub Desktop.
Create new repo for mr/vcsh
#!/bin/sh
set -e
repourl="$1"
reponame="$(echo "$repourl" | sed -r 's#.*/([^.]+).git#\1#')"
status() {
echo "[vcsh-new] $@" >&2
}
if [ "$repourl" = "$reponame" -o -n "$2" ]; then
status "Please call me like this: $0 [git-url]"
exit 1
fi
mrdir="$HOME/.config/mr"
alldir="$mrdir/available.d"
actdir="$mrdir/config.d"
repdir=".config/vcsh/repo.d/$reponame.git"
status "Creating mr config $reponame.vcsh"
echo "[\$HOME/$repdir]
checkout = vcsh clone $repourl" > "$alldir/$reponame.vcsh"
status "Enabling new config"
ln -s "../available.d/$reponame.vcsh" "$actdir"
status "Registering new repo with mr"
vcsh mr add "$alldir/$reponame.vcsh"
vcsh mr add "$actdir/$reponame.vcsh"
status "Doing initial checkout"
mr -d "$HOME/$repdir" up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment