2 # TopGit - A different patch queue manager
3 # Copyright (C) Petr Baudis <pasky@suse.cz> 2008
4 # Copyright (C) Kyle J. McKay <mackyle@gmail.com> 2015
7 USAGE
="Usage: ${tgname:-tg} [...] info [--heads] [<name>]"
11 if [ "${1:-0}" != 0 ]; then
12 printf '%s\n' "$USAGE" >&2
14 printf '%s\n' "$USAGE"
23 while [ $# -gt 0 ]; do case "$1" in
31 echo "Unknown option: $1" >&2
38 [ $# -gt 0 ] ||
set -- HEAD
39 [ $# -eq 1 ] || die
"name already specified ($1)"
42 # true if $1 is an ancestor of (or the same as) $2
45 [ -z "$(git rev-list --max-count=1 "$1" --not "$2" --)" ]
48 if [ -n "$heads" ]; then
49 hash="$(git rev-parse --verify --quiet "$name" --)" || die
"no such ref: $name"
50 $tg summary
--tgish-only --heads |
51 while read -r head; do
52 if is_ancestor
"$hash" "refs/heads/$head"; then
59 name
="$(verify_topgit_branch "${name:-HEAD}")"
60 base_rev
="$(git rev-parse --short --verify "refs
/top-bases
/$name" -- 2>/dev/null)" ||
61 die
"not a TopGit-controlled branch"
63 measure
="$(measure_branch "$name" "$base_rev")"
65 echo "Topic Branch: $name ($measure)"
66 if [ "$(git rev-parse --verify --short "$name" --)" = "$base_rev" ]; then
71 git cat-file blob
"$name:.topmsg" |
grep ^Subject
: ||
:
73 echo "Base: $base_rev"
74 branch_contains
"refs/heads/$name" "refs/top-bases/$name" ||
75 echo "* Base is newer than head! Please run \`$tgdisplay update\`."
77 if has_remote
"$name"; then
78 echo "Remote Mate: $base_remote/$name"
79 branch_contains
"refs/top-bases/$name" "refs/remotes/$base_remote/top-bases/$name" ||
80 echo "* Local base is out of date wrt. the remote base."
81 branch_contains
"refs/heads/$name" "refs/remotes/$base_remote/$name" ||
82 echo "* Local head is out of date wrt. the remote head."
83 branch_contains
"refs/remotes/$base_remote/$name" "refs/heads/$name" ||
84 echo "* Local head is ahead of the remote head."
87 git cat-file blob
"$name:.topdeps" 2>/dev
/null |
88 sed '1{ s/^/Depends: /; n; }; s/^/ /;'
90 depcheck
="$(get_temp tg-depcheck)"
92 needs_update
"$name" >"$depcheck" ||
:
93 if [ -n "$missing_deps" ]; then
94 echo "MISSING: $missing_deps"
96 depcheck2
="$(get_temp tg-depcheck2)"
97 sed '/^!/d' <"$depcheck" >"$depcheck2"
98 if [ -s "$depcheck2" ]; then
99 echo "Needs update from:"
101 sed 's/ [^ ]* *$//' |
# last is $name
102 sed 's/^[:] //' |
# don't distinguish base updates
103 sed 's/^% /~/' |
# but we may need special remote handling
104 while read dep chain
; do
107 case "$dep" in "~"?
*)
110 #dep2="refs/remotes/$base_remote/$dep"
113 [ -n "$chain" ] && printf '%s' "(<= $(echo "$chain" | sed 's/ / <= /')) "
114 dep_parent
="${chain%% *}"
115 printf '%s' "($(measure_branch "$dep" "${dep2:-$name}"))"
119 echo "Up-to-date${missing_deps:+ (except for missing dependencies)}."