This repository has been archived by the owner on Jan 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
tg-info.sh
76 lines (63 loc) · 1.98 KB
/
tg-info.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
# TopGit - A different patch queue manager
# (c) Petr Baudis <[email protected]> 2008
# GPLv2
name=
## Parse options
while [ -n "$1" ]; do
arg="$1"; shift
case "$arg" in
-*)
echo "Usage: tg [...] info [<name>]" >&2
exit 1;;
*)
[ -z "$name" ] || die "name already specified ($name)"
name="$arg";;
esac
done
[ -n "$name" ] || name="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
die "not a TopGit-controlled branch"
measure="$(measure_branch "$name" "$base_rev")"
echo "Topic Branch: $name ($measure)"
if [ "$(git rev-parse --short "$name")" = "$base_rev" ]; then
echo "* No commits."
exit 0
fi
git cat-file blob "$name:.topmsg" | grep ^Subject: || :
echo "Base: $base_rev"
branch_contains "$name" "$base_rev" ||
echo "* Base is newer than head! Please run \`$tg update\`."
if has_remote "$name"; then
echo "Remote Mate: $base_remote/$name"
branch_contains "$base_rev" "refs/remotes/$base_remote/top-bases/$name" ||
echo "* Local base is out of date wrt. the remote base."
branch_contains "$name" "refs/remotes/$base_remote/$name" ||
echo "* Local head is out of date wrt. the remote head."
branch_contains "refs/remotes/$base_remote/$name" "$name" ||
echo "* Local head is ahead of the remote head."
fi
git cat-file blob "$name:.topdeps" |
sed '1{ s/^/Depends: /; n; }; s/^/ /;'
depcheck="$(get_temp tg-depcheck)"
missing_deps=
needs_update "$name" >"$depcheck" || :
if [ -n "$missing_deps" ]; then
echo "MISSING: $missing_deps"
fi
if [ -s "$depcheck" ]; then
echo "Needs update from:"
cat "$depcheck" |
sed 's/ [^ ]* *$//' | # last is $name
sed 's/^: //' | # don't distinguish base updates
while read dep chain; do
echo -n "$dep "
[ -n "$chain" ] && echo -n "(<= $(echo "$chain" | sed 's/ / <= /')) "
dep_parent="${chain%% *}"
echo -n "($(measure_branch "$dep" "${dep2:-$name}"))"
echo
done | sed 's/^/\t/'
else
echo "Up-to-date."
fi
# vim:noet