From dfc2f49646ddf8f8b861e810a062600f86f4acbb Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 30 Apr 2017 22:28:38 -0400 Subject: Rewrite function systr_checkout() --- checkout.sh | 49 ++++++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/checkout.sh b/checkout.sh index ab9d4bd..9ae1235 100644 --- a/checkout.sh +++ b/checkout.sh @@ -65,40 +65,36 @@ function systr_init_wktree # # Reset a worktree to the state at . If is given, # checkout also initializes a new worktree at the CWD. If -# is given, the path is assumed to be located on a remote machine -# and is contacted over SSH. While resetting to the state at -# , all local uncommitted changes are lost. +# is given, the path is assumed to be located on a remote machine. +# While resetting to the state at , all local uncommitted +# changes are lost. # # After checkout, BASE and TRAC will be set to . ## function systr_checkout { - # check arguments # - if [ $# -lt 2 ]; then - echo "Missing required parameters" - exit + if [ $# -lt 1 ]; then + echo "Fatal: too few arguments to systr_checkout" + exit 1 fi - # init worktree # - if [ $# -gt 2 ]; then - init_wktree $@ - fi + version="$1" - # perform checkout # - read remote <.systr/remote - read path <.systr/path - version=$2 + if [ $# -gt 1 ]; then + shift + systr_init_wktree "$@" + read remote <.systr/remote + read path <.systr/path + fi if [[ "$version" == "NULL" ]]; then echo "Checking out NULL :: Checkout not performed" exit fi - commit=$(get_commit "$version") - symref=$(get_symref "$version") - + commit=$(systr_repo_resolve_reference "$version") echo "$commit" >.systr/BASE - echo "$symref" >.systr/TRAC + echo "$version" >.systr/TRAC if [[ "$commit" == "NULL" ]]; then echo "Nothing to checkout" @@ -106,18 +102,5 @@ function systr_checkout fi echo "Checking out files..." - - # local repository # - if [[ "$remote" == "" ]]; then - rsync -az --info=progress2 --info=stats2 \ - --delete --exclude='*.systr' \ - "$path/$commit/" . - - # remote repository # - else - rsync -az -e ssh --info=progress2 --info=stats2 \ - --delete --exclude='*.systr' \ - "$remote:$path/$commit/" . - - fi + systr_rsync_normal "$path/revs/$commit/" . } -- cgit v1.2.3