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 lineseparating entries */
27+ # print blank lineto separate entries
2828if (datetime != "")
2929{
3030printf ("%s| %10d|%s\n", datetime, NR, "");
3131printf ("%s| %10d|%s\n", datetime, NR, "---");
32- /*printf ("%s| %10d|%s\n", datetime, NR+1, "");*/
3332}
34- }
35-
36- $0 ~ /^====*$/ || $0 ~ /^----*$/ \
37- {
3833datetime="";
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
4842datetime=$2"-"$3
49- if (workingfile != "" && skip == "N" )
43+ if (workingfile != "")
5044{
45+ # remove semicolon from committer's name
5146gsub(";", "", $5);
5247printf ("%s| %10d|%s\n", datetime, NR-2, workingfile);
5348printf ("%s| %10d|%s\n", datetime, NR-1, $0);
54- /* printf ("%s| %10d|%s\n", datetime, NR, "");*/
49+ # output name of committer
5550printf ("%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+ #
7266if ($0 ~ /^\//)
7367{
68+ # If there are a different number of narrative
69+ # lines, they can not possibly be the same.
7470if (slot != oldslot)
7571same = "N";
7672else
@@ -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
9086if (same == "N")
9187{
9288if (oldslot)
9389for (i=1; i <= oldslot; i++)
9490print oldnarr[i];
95- /* save the current narrative */
91+
92+ # save the current narrative
9693for (i=1; i <= slot; i++)
9794oldnarr[i] = narr[i];
9895oldslot = slot;
9996}
10097slot = 0;
10198
102- /* dump out the previous filename */
99+ # dump out the previous filename
103100print save_working;
104101
105- /* store the current filename for later printing */
102+ # store the current filename for later printing
106103save_working = $0;
107104}
105+ # we have a narrative line
108106else if ($1 != "date:")
109107{
110- /* accumulate narrative */
108+ # accumulate narrative
111109narr[++slot] = $0;
112110}
113111}
114112END{
115- /* dump out the last filename */
113+ # dump out the last filename
116114print save_working;
117115
118- /* dump out the last narrative */
116+ # dump out the last narrative
119117for (i=1; i <= slot; i++)
120118print narr[i];
121119}'