1515
1616cat "$@" |
1717
18- # mark each line with a datetime and line number, for sorting and
19- # merging we don't print anything from the -- or == line and the
20- # date:
18+ # mark each line with a datetime and line number, for sorting and merging
19+ # We don't print anything from the -- or == line and the date:
2120
2221awk '
22+ # store working directory
2323 $0 ~ /^Working file:/ {workingfile = "/" $3}
2424
25- ($0 ~ /^====*$/ || $0 ~ /^----*$/) && skip == "N" \
25+ ($0 ~ /^====*$/ || $0 ~ /^----*$/) \
2626 {
27- /* print blank line separating entries */
27+ # print blank line to separate entries
2828 if (datetime != "")
2929 {
3030 printf ("%s| %10d|%s\n", datetime, NR, "");
3131 printf ("%s| %10d|%s\n", datetime, NR, "---");
32- /* printf ("%s| %10d|%s\n", datetime, NR+1, "");*/
3332 }
34- }
35-
36- $0 ~ /^====*$/ || $0 ~ /^----*$/ \
37- {
3833 datetime="";
39- skip="N";
4034 }
4135
42- datetime != "" && skip == "N" \
43- {printf ("%s| %10d| %s\n", datetime, NR, $0);}
36+ # if we have a saved datetime, print filename, date line, and committer
37+ datetime != "" {printf ("%s| %10d| %s\n", datetime, NR, $0);}
4438
4539 $1 == "date:" \
4640 {
47- /* get entry date */
41+ # get entry date
4842 datetime=$2"-"$3
49- if (workingfile != "" && skip == "N" )
43+ if (workingfile != "")
5044 {
45+ # remove semicolon from committer's name
5146 gsub(";", "", $5);
5247 printf ("%s| %10d|%s\n", datetime, NR-2, workingfile);
5348 printf ("%s| %10d|%s\n", datetime, NR-1, $0);
54- /* printf ("%s| %10d|%s\n", datetime, NR, "");*/
49+ # output name of committer
5550 printf ("%s| %10d| %70s\n", datetime, NR+1, $5);
5651 }
5752 }
5853
59- $0 ~ /^====*$/ {workingfile=""}' |
54+ /* clear working file */
55+ $0 ~ /^====*$/ {workingfile=""}' |
6056
6157sort | cut -d'|' -f3 | cat |
6258
6359# collect duplicate narratives
60+
6461awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
6562 {
66- /* filename */
67- /* We have a filename, so we look at the previous */
68- /* narrative to see if it is new narrative text.*/
69- /* */
70- /* If there are a different number of narrative */
71- /* lines, they can not possibly be the same. */
63+ # We have a filename, so we look at the previous
64+ # narrative to see if it is new narrative text.
65+ #
7266 if ($0 ~ /^\//)
7367 {
68+ # If there are a different number of narrative
69+ # lines, they can not possibly be the same.
7470 if (slot != oldslot)
7571 same = "N";
7672 else
@@ -86,36 +82,38 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
8682 }
8783 }
8884
89- /* dump out the old narrative if it is new */
85+ # dump out the old narrative if it is new
9086 if (same == "N")
9187 {
9288 if (oldslot)
9389 for (i=1; i <= oldslot; i++)
9490 print oldnarr[i];
95- /* save the current narrative */
91+
92+ # save the current narrative
9693 for (i=1; i <= slot; i++)
9794 oldnarr[i] = narr[i];
9895 oldslot = slot;
9996 }
10097 slot = 0;
10198
102- /* dump out the previous filename */
99+ # dump out the previous filename
103100 print save_working;
104101
105- /* store the current filename for later printing */
102+ # store the current filename for later printing
106103 save_working = $0;
107104 }
105+ # we have a narrative line
108106 else if ($1 != "date:")
109107 {
110- /* accumulate narrative */
108+ # accumulate narrative
111109 narr[++slot] = $0;
112110 }
113111 }
114112 END {
115- /* dump out the last filename */
113+ # dump out the last filename
116114 print save_working;
117115
118- /* dump out the last narrative */
116+ # dump out the last narrative
119117 for (i=1; i <= slot; i++)
120118 print narr[i];
121119 }'
0 commit comments