Skip to content

Commit

Permalink
Merge pull request #40 from rohieb/tig
Browse files Browse the repository at this point in the history
tig: add subcommand to browse an umpf and its context interactively
  • Loading branch information
michaelolbrich authored Jul 31, 2024
2 parents 09bc9e6 + 4487787 commit b10a8fb
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 b10a8fb

Please sign in to comment.