summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2017-08-30 02:12:53 -0400
committerMalf Furious <m@lfurio.us>2017-08-30 02:12:53 -0400
commit54a89c14243181e93881b5b88518681a3290b2d3 (patch)
treef9b2dd895ab39c3566437ec59f354e5761a5f4f8
parent5685ffd3773d987aca36b6f6be3e2bab88598a92 (diff)
downloadsystrunk-54a89c14243181e93881b5b88518681a3290b2d3.tar.gz
systrunk-54a89c14243181e93881b5b88518681a3290b2d3.zip
Add log op
-rw-r--r--main.sh2
-rw-r--r--repo-access.sh36
2 files changed, 38 insertions, 0 deletions
diff --git a/main.sh b/main.sh
index 86fcaff..957cc24 100644
--- a/main.sh
+++ b/main.sh
@@ -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
+}