From 2450448b7e860791f2ea7bdd0c3bd6c046798923 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Fri, 19 Apr 2024 20:14:52 +0100 Subject: [PATCH] feat(sapling): add script to push up all bookmarks in a stack --- site-modules/core/files/bin/sl-push-bookmakrs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 site-modules/core/files/bin/sl-push-bookmakrs diff --git a/site-modules/core/files/bin/sl-push-bookmakrs b/site-modules/core/files/bin/sl-push-bookmakrs new file mode 100755 index 0000000..c5332da --- /dev/null +++ b/site-modules/core/files/bin/sl-push-bookmakrs @@ -0,0 +1,28 @@ +#!/bin/bash + +default_path="$(sl config paths.default)" +url="${default_path%*.git}" + +# +# "top % public()" => non-public commits in my stack +# "top" => from the top of my stack +# "% X" => except not in X +# "public()" => public commits +# +previous_bookmark_query="" +previous_bookmark="" +for i in $(sl log -r "top % public()" -T "{bookmarks} "); do + commits="$(sl log -r "::$i % public()$previous_bookmark_query")" + + if [[ -z "$previous_bookmark" ]]; then + echo "$url/compare/$i" + else + echo "$url/compare/$previous_bookmark...$i" + fi + + echo "$commits" + sl push -f -r "$i" --to "remote/$i" 2>&1 | grep -E "[\+\*]" + + previous_bookmark_query=" % ::$i" + previous_bookmark="$i" +done