15
15
16
16
cat "$@" |
17
17
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:
21
20
22
21
awk '
22
+ # store working directory
23
23
$0 ~ /^Working file:/ {workingfile = "/" $3}
24
24
25
- ($0 ~ /^====*$/ || $0 ~ /^----*$/) && skip == "N" \
25
+ ($0 ~ /^====*$/ || $0 ~ /^----*$/) \
26
26
{
27
- /* print blank line separating entries */
27
+ # print blank line to separate entries
28
28
if (datetime != "")
29
29
{
30
30
printf ("%s| %10d|%s\n", datetime, NR, "");
31
31
printf ("%s| %10d|%s\n", datetime, NR, "---");
32
- /* printf ("%s| %10d|%s\n", datetime, NR+1, "");*/
33
32
}
34
- }
35
-
36
- $0 ~ /^====*$/ || $0 ~ /^----*$/ \
37
- {
38
33
datetime="";
39
- skip="N";
40
34
}
41
35
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);}
44
38
45
39
$1 == "date:" \
46
40
{
47
- /* get entry date */
41
+ # get entry date
48
42
datetime=$2"-"$3
49
- if (workingfile != "" && skip == "N" )
43
+ if (workingfile != "")
50
44
{
45
+ # remove semicolon from committer's name
51
46
gsub(";", "", $5);
52
47
printf ("%s| %10d|%s\n", datetime, NR-2, workingfile);
53
48
printf ("%s| %10d|%s\n", datetime, NR-1, $0);
54
- /* printf ("%s| %10d|%s\n", datetime, NR, "");*/
49
+ # output name of committer
55
50
printf ("%s| %10d| %70s\n", datetime, NR+1, $5);
56
51
}
57
52
}
58
53
59
- $0 ~ /^====*$/ {workingfile=""}' |
54
+ /* clear working file */
55
+ $0 ~ /^====*$/ {workingfile=""}' |
60
56
61
57
sort | cut -d'|' -f3 | cat |
62
58
63
59
# collect duplicate narratives
60
+
64
61
awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
65
62
{
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
+ #
72
66
if ($0 ~ /^\//)
73
67
{
68
+ # If there are a different number of narrative
69
+ # lines, they can not possibly be the same.
74
70
if (slot != oldslot)
75
71
same = "N";
76
72
else
@@ -86,36 +82,38 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
86
82
}
87
83
}
88
84
89
- /* dump out the old narrative if it is new */
85
+ # dump out the old narrative if it is new
90
86
if (same == "N")
91
87
{
92
88
if (oldslot)
93
89
for (i=1; i <= oldslot; i++)
94
90
print oldnarr[i];
95
- /* save the current narrative */
91
+
92
+ # save the current narrative
96
93
for (i=1; i <= slot; i++)
97
94
oldnarr[i] = narr[i];
98
95
oldslot = slot;
99
96
}
100
97
slot = 0;
101
98
102
- /* dump out the previous filename */
99
+ # dump out the previous filename
103
100
print save_working;
104
101
105
- /* store the current filename for later printing */
102
+ # store the current filename for later printing
106
103
save_working = $0;
107
104
}
105
+ # we have a narrative line
108
106
else if ($1 != "date:")
109
107
{
110
- /* accumulate narrative */
108
+ # accumulate narrative
111
109
narr[++slot] = $0;
112
110
}
113
111
}
114
112
END {
115
- /* dump out the last filename */
113
+ # dump out the last filename
116
114
print save_working;
117
115
118
- /* dump out the last narrative */
116
+ # dump out the last narrative
119
117
for (i=1; i <= slot; i++)
120
118
print narr[i];
121
119
}'
0 commit comments