aboutsummaryrefslogtreecommitdiff
path: root/src/tools/pgcvslog
blob: f40f2c6d645f0b6b43a5346afe1d41c239f24bc7 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
:
# This utility is used to generate a compact list of changes for each
# release, bjm 2000-02-22

# Usage $0 file

# no branches: 
# cvs log -d '>1999-06-14 00:00:00 GMT' . > log
#
# pre and post-branch logs:
# find . -name CVS -type d -exec touch '{}/Entries.Static' \;
# cvs log -d'2000-05-08 00:00:00 GMT<2000-05-29 00:00:00 GMT'
# cvs log -d'>2000-05-29 00:00:00 GMT' -rREL7_0_PATCHES
# find . -name CVS -type d -exec rm '{}/Entries.Static' \;
#

cat "$@" |

# mark each line with a datetime and line number, for sorting and merging
# we don't print anything from the -- or == line and the date:

awk '
	$0 ~ /^Working file:/	{workingfile = "/" $3}

	($0 ~ /^====*$/ || $0 ~ /^----*$/) && skip == "N" \
	{
		/* print blank line separating entries */
		if (datetime != "")
		{
			printf ("%s| %10d|%s\n", datetime, NR, "");
			printf ("%s| %10d|%s\n", datetime, NR, "---");
/*			printf ("%s| %10d|%s\n", datetime, NR+1, "");*/
		}
	}

	$0 ~ /^====*$/ || $0 ~ /^----*$/ \
	{
		datetime="";
		skip="N";
	}

	datetime != "" && skip == "N" \
		{printf ("%s| %10d| %s\n", datetime, NR, $0);}

	$1 == "date:"	\
	{
		/* get entry date */
		datetime=$2"-"$3
		if (workingfile != "" && skip == "N")
		{
			gsub(";", "", $5);
			printf ("%s| %10d|  %70s\n", datetime, NR-2, $5);
			printf ("%s| %10d|%s\n", datetime, NR-1, workingfile);
			printf ("%s| %10d|%s\n", datetime, NR, $0);
			printf ("%s| %10d|%s\n", datetime, NR+1, "");
		}
	}

	$0 ~ /^====*$/ 			{workingfile=""}' |

sort | cut -d'|' -f3 | cat |

# collect duplicate narratives
awk '	BEGIN	{ slot = 0;}
	{
		if ($0 ~ /^\//)
		{
			if (slot != oldslot)
				same = 0;
			else
			{
				same = 1;
				for (i=1; i <= slot; i++)
				{
					if (oldnarr[i] != narr[i])
						same = 0;
				}
			}

			if (oldslot && !same)
				for (i=1; i <= oldslot; i++)
					print oldnarr[i];
			for (i=1; i <= slot; i++)
				oldnarr[i] = narr[i];
			oldslot = slot;
			slot = 0;
			print save_working;
			save_working = $0;
 		}
		else if ($1 != "date:")
			narr[++slot] = $0;
	}
	END	{
			print save_working;
			for (i=1; i <= slot; i++)
				print narr[i];
		}'