From 8f3e802fa4792c72959daa658360043401a62f7c Mon Sep 17 00:00:00 2001 From: Mike O'Connor Date: Sun, 29 Aug 2010 21:12:09 -0400 Subject: [PATCH] added login/ls/list Signed-off-by: Mike O'Connor --- movein | 63 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/movein b/movein index 00bfcab..a6a7bc4 100755 --- a/movein +++ b/movein @@ -31,13 +31,20 @@ SYNOPSIS $bn command [options] $bn init + $bn ls + $bn list $bn add repository_name $bn new repository_name file1 [file2 file3...] + $bn login repository_name COMMANDS init create ~/.mrconfig + ls + list + show a list of repositories + add repository_name checkout the repository from the remote host and add it to mr's configuration @@ -46,19 +53,23 @@ COMMANDS create a new repository on the remote host, and checkin the listed files to the new repository. Add the new repository to mr's configuration + + login repository_name + start a subshell in repository_name + EOF exit 1 } -GIT_HOST=flounder.vireo.org +GIT_HOST=git.vireo.org REMOTE_REPOS=~/git -LOCAL_REPOS=~/.fgits +LOCAL_REPOS=~/.movein MRCONFIG=~/.mrconfig -MOVEIN=~/.movein +MOVEINRC=~/.moveinrc -[ -e source $MOVEIN ] && source $MOVEIN +[ -e "$MOVEINRC" ] && . "$MOVEINRC" init() { @@ -71,8 +82,8 @@ init() { exit 1 fi - if [ -e $MOVEIN ]; then - echo $MOVEIN already exists + if [ -e $MOVEINRC ]; then + echo $MOVEINRC already exists exit 1 fi @@ -88,10 +99,10 @@ init() { REMOTE_REPOS=~/git fi - echo -n "Local repository directory? [~/.fgit] " + echo -n "Local repository directory? [~/.movein] " read LOCAL_REPOS if [ -z "$LOCAL_REPOS" ]; then - LOCAL_REPOS=~/.fgits + LOCAL_REPOS=~/.movein fi echo -n "Location of .mrconfig file? [~/.mrconfig] " @@ -100,14 +111,17 @@ init() { MRCONFIG=~/.mrconfig fi - cat < .movein + cat < $MOVEINRC GIT_HOST=$GIT_HOST REMOTE_REPOS=$REMOTE_REPOS LOCAL_REPOS=$LOCAL_REPOS MRCONFIG=$MRCONFIG EOF - mkdir $LOCAL_REPOS + if [ ! -d "$LOCAL_REPOS" ]; then + mkdir -p "$LOCAL_REPOS" + fi + cat < $MRCONFIG [DEFAULT] include = cat /usr/share/mr/git-fake-bare @@ -116,6 +130,16 @@ END } +login() { + if [ $# -ne 1 ]; then + usage + fi + + export GIT_DIR="$LOCAL_REPOS/${1}.git" + export GIT_WORK_TREE="$GIT_DIR/$(git config --get core.worktree)" + + $SHELL -i || : +} add() { if [ $# -ne 1 ]; then @@ -149,6 +173,10 @@ END } +list() { + find "${LOCAL_REPOS}" -mindepth 1 -maxdepth 1 -type d | sed 's,^.*/\([^/]*\).git$,\1,' +} + new() { if [ $# -lt 2 ]; then usage @@ -197,6 +225,7 @@ END } + command=$1 ; shift case "$command" in init) @@ -208,4 +237,18 @@ case "$command" in new) new $@ ;; + login) + login $@ + ;; + ls) + list + ;; + list) + list + ;; + + *) + usage + exit 1 + ;; esac -- 2.39.5