From 4487787b5abf48feb1850e16a025203784b20a01 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Wed, 17 Apr 2024 11:48:26 +0200 Subject: [PATCH] tig: add subcommand to browse an umpf and its context interactively The 'tig' subcommand makes it possible to browse an umpf interactively in tig(1) while showing the local and remote state of all topic branches. This can give a broader overview how the topic branches have developed before building another umpf. For simplicity sake, also limit the range of the topics to the history leading up from the umpf-base. Signed-off-by: Roland Hieber --- bash_completion | 2 +- umpf | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/bash_completion b/bash_completion index 48c14f8..5313106 100644 --- a/bash_completion +++ b/bash_completion @@ -38,7 +38,7 @@ _umpf_completion() "") COMPREPLY=( $( compgen -W "${completion_cmds[*]} help" -- $cur ) ) ;; - diff|show|tag|build) + diff|show|tag|tig|build) local -a refs refs=( $( compgen -W "$( git for-each-ref --format='%(refname:short)' refs/tags refs/heads refs/remotes)" -- $cur ) ) if [ ${#refs[@]} -eq 0 ]; then diff --git a/umpf b/umpf index 1625b52..9f90f2e 100755 --- a/umpf +++ b/umpf @@ -200,6 +200,8 @@ usage() { diff show patches not in any topic branch (not upstream) and patches missing locally show show an useries file from an umpf + tig [umpf] browse an umpf interactively, showing state of + local, remote and remote-tracking topic branches tag generate a utag from an umerge format-patch generate a useries file and patch stack @@ -1874,6 +1876,38 @@ do_show() { cleanup } +### namespace: tig ### + +tig_topic() { + ${GIT} show-ref -s "${content}" >> "${STATE}/refs" +} + +tig_release() { + echo "${content}" >> "${STATE}/refs" +} + +tig_hashinfo() { + echo "${content}" >> "${STATE}/refs" +} + +### command: tig ### + +do_tig () { + local -a refs + local base + + prepare_persistent tig "${@}" + parse_series tig "${STATE}/series" + + mapfile -t refs < "${STATE}/refs" + base="$(<"${STATE}/base-name")" + + # cut off each ref at base + tig ^"${base}"^ "${refs[@]}" + + cleanup +} + ### command: init ### do_init() {