diff options
| author | Malf Furious <m@lfurio.us> | 2017-09-05 00:02:50 -0400 | 
|---|---|---|
| committer | Malf Furious <m@lfurio.us> | 2017-09-05 00:02:50 -0400 | 
| commit | 9ef4ce9ff896050cb8f1fac65fe9aca7ca5aa594 (patch) | |
| tree | 56713a3a861c7dbbc3122796e403f43c46d8cfa3 | |
| parent | 0ffd21d98bb9154007640ec01f843914792739c7 (diff) | |
| download | systrunk-9ef4ce9ff896050cb8f1fac65fe9aca7ca5aa594.tar.gz systrunk-9ef4ce9ff896050cb8f1fac65fe9aca7ca5aa594.zip | |
Rewrite commit op to drop remote support
Diffstat (limited to '')
| -rw-r--r-- | commit.sh | 49 | 
1 files changed, 26 insertions, 23 deletions
| @@ -1,37 +1,40 @@  ## -# systr_record_commit_mesg <commit> [<mesg>] +# systr_record_commit_mesg <commit> <branch> [<mesg>]  #  # Setup and present user with an editor to enter a commit message for  # the given commit ID.  If <mesg> is given, that content will be the -# default in the opened text file.  Once user is finished, the file is -# moved into the repository root, awaiting a call to systr_repo_finish_commit. +# default in the opened file.  If <branch> does not match TRAC, an +# additional message will be given to the user, letting them know they +# are committing to another branch.  Once user is finished, the file +# is moved into the repository root, awaiting a call to systr_repo_finish_commit.  ##  function systr_record_commit_mesg  { -    if [ $# -eq 0 ]; then -        echo "Fatal: too few arguments to systr_record_commit_mesg" +    if [ $# -lt 2 ]; then +        echo "Fatal: too few args to record_commit_mesg" >&2          exit 1      fi      commit="$1" +    branch="$2" -    if [ $# -gt 1 ]; then -        mesg="$2" +    if [ $# -gt 2 ]; then +        mesg="$3"      else          mesg=""      fi      echo "$mesg" >.systr/commit-edit-mesg.txt      echo "# --" >>.systr/commit-edit-mesg.txt -    systrunk status | sed 's/^/# /' >>.systr/commit-edit-mesg.txt -    vi .systr/commit-edit-mesg.txt -    sed '/^#/ d' <.systr/commit-edit-mesg.txt >.systr/commit.mesg -    if [[ "$remote" == "" ]]; then -        mv .systr/commit.mesg "$path/revs/$commit.mesg" -    else -        ssh "$remote" "systrunk message-commit \"$commit\"" <.systr/commit.mesg +    if [[ "$branch" != "$TRAC" ]]; then +        echo "# Committing to $branch" >>.systr/commit-edit-mesg.txt +        echo "#" >>.systr/commit-edit-mesg.txt      fi + +    systrunk status | sed 's/^/# /' >>.systr/commit-edit-mesg.txt +    vi .systr/commit-edit-mesg.txt +    sed '/^#/ d' <.systr/commit-edit-mesg.txt >"$path/revs/$commit.mesg"  }  ## @@ -47,23 +50,23 @@ function systr_record_commit_mesg  ##  function systr_commit  { -    if [ $# -ne 0 ]; then +    if [ $# -gt 0 ]; then          branch="$1"      else          branch="$TRAC"      fi      if [[ "$branch" == "BASE" ]]; then -        echo "Fatal: bad branch name" +        echo "Fatal: bad branch name BASE" >&2          exit 1      elif [[ "$branch" == "TRAC" ]]; then -        echo "Fatal: bad branch name" +        echo "Fatal: bad branch name TRAC" >&2          exit 1      elif [[ "$branch" == "NULL" ]]; then -        echo "Fatal: bad branch name" +        echo "Fatal: bad branch name NULL" >&2          exit 1      elif [[ "$branch" == "MERG" ]]; then -        echo "Fatal: bad branch name" +        echo "Fatal: bad branch name MERG" >&2          exit 1      fi @@ -71,18 +74,18 @@ function systr_commit      systr_repo_resolve_reference "$branch" >/dev/null 2>&1 || echo "Creating new branch $branch"      if [[ "$BASE" != "$branchcommit" ]]; then -        echo "Worktree is out-of-date, won't commit" +        echo "Worktree is out-of-date, won't commit" >&2          exit 1      fi      commit=$(systr_repo_create_commit) -    systr_record_commit_mesg "$commit" +    systr_record_commit_mesg "$commit" "$branch"      echo "Sending files..."      if [[ "$branchcommit" != "NULL" ]]; then -        systr_rsync_normal . "$path/revs/$commit" "../$branchcommit" +        systr_rsync_normal . "$path/revs/$commit/" "../$branchcommit/"      else -        systr_rsync_normal . "$path/revs/$commit" +        systr_rsync_normal . "$path/revs/$commit/"      fi      systr_repo_finish_commit "$commit" "$branchcommit" | 
