From: Mike O'Connor Date: Sat, 8 Oct 2011 18:17:06 +0000 (-0400) Subject: Merge remote-tracking branch 'refs/remotes/gregor/gregoa' X-Git-Url: https://git.toastfreeware.priv.at/gregoa/movein.git/commitdiff_plain/0c658fa07c706200da979d0b0131cb1250010ce2?hp=1d0be81ac31542fede855d5014eaf3af107db090 Merge remote-tracking branch 'refs/remotes/gregor/gregoa' * don't clobber .mrconfig * fix whitespace * add ls-remotes command --- diff --git a/movein b/movein index 2fbdd55..c6c5137 100755 --- a/movein +++ b/movein @@ -34,17 +34,23 @@ SYNOPSIS $bn init $bn ls $bn list + $bn ls-r + $bn list-remote $bn add repository_name $bn new repository_name file1 [file2 file3...] $bn login repository_name COMMANDS init - create ~/.mrconfig + create ~/.moveinrc, create/update ~/.mrconfig ls list - show a list of repositories + show a list of local repositories + + ls-r + list-remote + show a list of remote repositories add repository_name checkout the repository from the remote host and add it to @@ -63,6 +69,7 @@ EOF exit 1 } +[ $# -ge 1 ] || usage GIT_HOST=git.vireo.org REMOTE_REPOS=~/git @@ -78,11 +85,6 @@ init() { usage fi - if [ -e $MRCONFIG ]; then - echo $MRCONFIG already exists - exit 1 - fi - if [ -e $MOVEINRC ]; then echo $MOVEINRC already exists exit 1 @@ -123,11 +125,7 @@ EOF mkdir -p "$LOCAL_REPOS" fi - cat < $MRCONFIG -[DEFAULT] -include = cat /usr/share/mr/git-fake-bare -END - + mr -c "$MRCONFIG" config DEFAULT include="cat /usr/share/mr/git-fake-bare" } @@ -139,7 +137,7 @@ login() { export GIT_DIR="$LOCAL_REPOS/${1}.git" export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)" - $SHELL -i || : + GIT_PS1_SHOWUNTRACKEDFILES= PSMOVEIN="movein:${1}" $SHELL -i || : } add() { @@ -161,23 +159,26 @@ add() { 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 core.bare false - GIT_WORK_TREE="$PWD" git pull + git config status.showUntrackedFiles no + GIT_WORK_TREE="$LOCAL_REPO/../../" git pull trap - 0 - cat <> $MRCONFIG -[$LOCAL_REPO] -checkout = git_fake_bare_checkout '$REPO_URL' '$REPO_NAME' '../../' -END + mr -c "$MRCONFIG" config "$LOCAL_REPO" checkout="git_fake_bare_checkout '$REPO_URL' 'REPO_NAME' '../../'" fi - } list() { find "${LOCAL_REPOS}" -mindepth 1 -maxdepth 1 -type d | sed 's,^.*/\([^/]*\).git$,\1,' } +listremote() { + ssh $GIT_HOST " + find '${REMOTE_REPOS}' -mindepth 1 -maxdepth 1 -type d | sed 's,^.*/\([^/]*\).git$,\1,' + " > $MRCONFIG -[$LOCAL_REPO] -checkout = git_fake_bare_checkout '$REPO_URL' '$REPO_NAME' '../../' -END + mr -c "$MRCONFIG" config "$LOCAL_REPO" checkout="git_fake_bare_checkout '$REPO_URL' 'REPO_NAME' '../../'" fi } @@ -233,19 +230,25 @@ case "$command" in init $@ ;; add) - add $@ + add $@ ;; new) - new $@ + new $@ ;; login) - login $@ + login $@ ;; ls) - list + list ;; list) - list + list + ;; + ls-r) + listremote + ;; + list-remote) + listremote ;; *)