Meta/cook.sh: list topics that forked from others a bit more sensibly

Junio C Hamano committed Dec 9, 2009 at 15:36 UTC 6a47f4f21e8463159c4b8d4fefe1130eb8b81a28
1 file changed +16 -4
cook.sh
+16 -4
@@ -90,6 +90,9 @@ add_desc () {
90 while :
91 do
92 other=$1
93 + case "$other" in
94 + "#EPO-"*) other="early parts of ${other#"#EPO-"}"
95 + esac
96 shift
97 case "$#,$others" in
98 0,)
@@ -125,11 +128,13 @@ show_topic () {
128 fi
129 }
130
131 +# List commits that are shared between more than one topic branches
132 while read b
133 do
134 git rev-list --no-merges "master..$b"
135 done <"$tmp.branches" | sort | uniq -d >"$tmp.shared"
136
137 +# Set of branches related to each other due to sharing the same commit
138 while read shared
139 do
140 b=$(git branch --contains "$shared" | sed -n -e 's/^..//' -e '/\//p')
@@ -141,7 +146,7 @@ while read b
146 do
147 related=$(grep " $b " "$tmp.related" | tr ' ' '\012' | sort -u | sed -e '/^$/d')
148
144 - based_on=
149 + based_on= based_on_msg=
150 used_by=
151 forks=
152 same_as=
@@ -158,12 +163,19 @@ do
163 ;;
164 0,*)
165 based_on="$based_on$r "
166 + based_on_msg="$based_on_msg$r "
167 ;;
168 *,0)
169 used_by="$used_by$r "
170 ;;
171 *,*)
166 - forks="$forks$r "
172 + if test $based -lt $bases
173 + then
174 + based_on="$based_on$r "
175 + based_on_msg="${based_on_msg}#EPO-$r "
176 + else
177 + forks="$forks$r "
178 + fi
179 ;;
180 esac
181 done
@@ -174,9 +186,9 @@ do
186
187 description=
188 test -z "$same_as" || add_desc 'is same as' $same_as
177 - test -z "$based_on" || add_desc 'uses' $based_on
189 + test -z "$based_on" || add_desc 'uses' $based_on_msg
190 test -z "$used_by" || add_desc 'is used by' $used_by
179 - test -z "$forks" || add_desc 'is related to' $forks
191 + test -z "$forks" || add_desc 'shares commits with' $forks
192
193 test -z "$description" ||
194 echo " (this branch$description.)"