Skip to content

Commit

Permalink
tig: add subcommand to browse an umpf and its context interactively
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rohieb committed Jul 29, 2024
1 parent 09bc9e6 commit 4487787
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions umpf
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ usage() {
diff <commit-ish> show patches not in any topic branch (not
upstream) and patches missing locally
show <commit-ish> show an useries file from an umpf
tig [umpf] browse an umpf interactively, showing state of
local, remote and remote-tracking topic branches
tag <commit-ish> generate a utag from an umerge
format-patch <utag> generate a useries file and patch stack
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 4487787

Please sign in to comment.