diff options
| -rw-r--r-- | main.sh | 2 | ||||
| -rw-r--r-- | repo-access.sh | 36 | 
2 files changed, 38 insertions, 0 deletions
@@ -36,6 +36,8 @@ function main          systr_commit "$@"      elif [[ "$cmd" == "tag" ]]; then          systr_repo_tag "$@" +    elif [[ "$cmd" == "log" ]]; then +        systr_repo_generate_log "$@"      else          echo "Fatal: $cmd not recognized"      fi diff --git a/repo-access.sh b/repo-access.sh index 6e5b481..dbf1b58 100644 --- a/repo-access.sh +++ b/repo-access.sh @@ -44,3 +44,39 @@ function systr_repo_resolve_reference          ssh "$remote" "systrunk resv-ref \"$symref\" \"$path\""      fi  } + +## +# systrunk log [<commit>=BASE] +# +# View commit history.  Generates a dump of all commits reachable +# from the given commit, or BASE if no argument given.  Works for +# either local/remote repository. +## +function systr_repo_generate_log +{ +    if [ $# -lt 1 ]; then +        commit="$BASE" +    else +        commit=$(systr_repo_resolve_reference "$1") +    fi + +    if [[ "$remote" == "" ]]; then +        while [[ "$commit" != "NULL" ]] +        do +            read date <"$path/revs/$commit/.date.systr" +            read author <"$path/revs/$commit/.author.systr" +            read email  <"$path/revs/$commit/.email.systr" + +            printf '%s %s\n' "$commit" "$date" +            printf '%s %s\n' "$author" "$email" +            echo "" +            cat "$path/revs/$commit/.mesg.systr" +            echo "" +            echo "" + +            read commit <"$path/revs/$commit/.commit.systr" +        done +    else +        ssh "$remote" "systrunk log \"$commit\"" +    fi +}  | 
