X-Git-Url: https://git.toastfreeware.priv.at/gregoa/movein.git/blobdiff_plain/ee203f1829d19cc02f9b33c24e47e05851471826..9d0455e099d333a521763ebb1cb5ec88b80d54a8:/movein diff --git a/movein b/movein index e13eb72..d2013da 100755 --- a/movein +++ b/movein @@ -7,7 +7,7 @@ # Free Software Foundation; either version 2, or (at your option) any # later version. # -# this program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -53,8 +53,11 @@ COMMANDS list-remote show a list of remote repositories + locate pattern + locate which repositories contain files matching pattern + add repository_name - checkout the repository from the remote host and add it to + checkout one or more repositories from the remote host and add it to mr's configuration new repository_name file1 [file2 file3...] @@ -88,7 +91,7 @@ MOVEINRC=~/.moveinrc init() { if [ $# -ne 0 ]; then - usage + usage fi if [ -e $MOVEINRC ]; then @@ -161,32 +164,35 @@ execin() { } add() { - if [ $# -ne 1 ]; then + if [ $# -lt 1 ]; then usage fi - REPO_NAME=$1.git ; shift - LOCAL_REPO=$LOCAL_REPOS/$REPO_NAME - REPO_URL=ssh://$GIT_HOST/$REMOTE_REPOS/$REPO_NAME - if [ -e "$LOCAL_REPO" ]; then + for REPO in "$@"; do + REPO_NAME=$REPO.git + LOCAL_REPO=$LOCAL_REPOS/$REPO_NAME + REPO_URL=ssh://$GIT_HOST/$REMOTE_REPOS/$REPO_NAME + + if [ -e "$LOCAL_REPO" ]; then echo $LOCAL_REPO already exists exit 1 - else - trap "rm -rf $LOCAL_REPO" 0 - mkdir "$LOCAL_REPO" - export GIT_DIR="$LOCAL_REPO" - git init --bare - git remote add origin $REPO_URL - git config branch.master.remote origin - git config branch.master.merge refs/heads/master - git config core.bare false - git config core.worktree ../../ - git config status.showUntrackedFiles no - GIT_WORK_TREE="$LOCAL_REPO/../../" git pull - trap - 0 - - mr -c "$MRCONFIG" config "$LOCAL_REPO" checkout="git_fake_bare_checkout '$REPO_URL' 'REPO_NAME' '../../'" - fi + else + trap "rm -rf $LOCAL_REPO" 0 + mkdir "$LOCAL_REPO" + export GIT_DIR="$LOCAL_REPO" + git init --bare + git remote add origin $REPO_URL + git config branch.master.remote origin + git config branch.master.merge refs/heads/master + git config core.bare false + git config core.worktree ../../ + git config status.showUntrackedFiles no + GIT_WORK_TREE="$LOCAL_REPO/../../" git pull + trap - 0 + + mr -c "$MRCONFIG" config "$LOCAL_REPO" checkout="git_fake_bare_checkout '$REPO_URL' 'REPO_NAME' '../../'" + fi + done } list() { @@ -199,28 +205,35 @@ listremote() { "