From: Joey Hess Date: Sat, 13 Oct 2007 17:24:56 +0000 (-0400) Subject: mr register: default to registering the current directory X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/fb4c5ab3cf865b15d2092ccbc90aa5f7bd416c16?ds=sidebyside;hp=d1e21e723b6deb2263449195f6e63e5246d2e8b5 mr register: default to registering the current directory --- diff --git a/mr b/mr index c5efb74..b65e623 100755 --- a/mr +++ b/mr @@ -18,7 +18,7 @@ B [options] diff B [options] log -B [options] register repository +B [options] register [repository] B [options] config section [parameter=[value] ...] @@ -80,8 +80,9 @@ List the repositories that mr will act on. =item register -The next parameter is the directory of an existing repository. The -repository will be registered in the mrconfig file. +Register an existing repository in the mrconfig file. By default, the +epository in the current directory is registered, or you can specify a +directory to register. =item config @@ -710,13 +711,12 @@ log = \ error "unknown repo type" \ fi register = \ - if [ -z "$1" ]; then \ - error "repository directory not specified" \ + if [ -n "$1" ]; then \ + cd "$1" \ fi \ - cd "$1" \ basedir="$(basename $(pwd))" \ if [ -d .svn ]; then \ - url=$(LANG=C svn info . | \ + url=$(LANG=C svn info . | \ grep -i ^URL: | cut -d ' ' -f 2) \ if [ -z "$url" ]; then \ error "cannot determine svn url" \ @@ -724,7 +724,7 @@ register = \ echo "Registering svn url: $url" \ mr config "$(pwd)" checkout="svn co $url $basedir" \ elif [ -d .git ]; then \ - url=$(LANG=C git-config --get remote.origin.url) \ + url=$(LANG=C git-config --get remote.origin.url) \ if [ -z "$url" ]; then \ error "cannot determine git url" \ fi \