Mercurial > cpython-lru_cache-weakref
annotate Tools/scripts/logmerge.py @ 65035:87f4b32905df 2.7
Cosmetic fix to use print function.
| author | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> |
|---|---|
| date | Fri, 01 Oct 2010 10:48:47 +0000 |
| parents | 1d84bf5f9478 |
| children |
| rev | line source |
|---|---|
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 #! /usr/bin/env python |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 """Consolidate a bunch of CVS or RCS logs read from stdin. |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 Input should be the output of a CVS or RCS logging command, e.g. |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 |
|
6404
ed6f6f032217
Fix comment to add the all-important trailing colon to the example.
Guido van Rossum <guido@python.org>
parents:
6051
diff
changeset
|
7 cvs log -rrelease14: |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 which dumps all log messages from release1.4 upwards (assuming that |
|
6404
ed6f6f032217
Fix comment to add the all-important trailing colon to the example.
Guido van Rossum <guido@python.org>
parents:
6051
diff
changeset
|
10 release 1.4 was tagged with tag 'release14'). Note the trailing |
|
ed6f6f032217
Fix comment to add the all-important trailing colon to the example.
Guido van Rossum <guido@python.org>
parents:
6051
diff
changeset
|
11 colon! |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 This collects all the revision records and outputs them sorted by date |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 rather than by file, collapsing duplicate revision record, i.e., |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 records with the same message for different files. |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 The -t option causes it to truncate (discard) the last revision log |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 entry; this is useful when using something like the above cvs log |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 command, which shows the revisions including the given tag, while you |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 probably want everything *since* that tag. |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
22 The -r option reverses the output (oldest first; the default is oldest |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
23 last). |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
24 |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
25 The -b tag option restricts the output to *only* checkin messages |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
26 belonging to the given branch tag. The form -b HEAD restricts the |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
27 output to checkin messages belonging to the CVS head (trunk). (It |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
28 produces some output if tag is a non-branch tag, but this output is |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
29 not very useful.) |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
30 |
|
28701
42de50e192df
Finally added a -h option to print the module docstring and exit. ;)
Barry Warsaw <barry@python.org>
parents:
27133
diff
changeset
|
31 -h prints this message and exits. |
|
42de50e192df
Finally added a -h option to print the module docstring and exit. ;)
Barry Warsaw <barry@python.org>
parents:
27133
diff
changeset
|
32 |
|
6404
ed6f6f032217
Fix comment to add the all-important trailing colon to the example.
Guido van Rossum <guido@python.org>
parents:
6051
diff
changeset
|
33 XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7 |
|
ed6f6f032217
Fix comment to add the all-important trailing colon to the example.
Guido van Rossum <guido@python.org>
parents:
6051
diff
changeset
|
34 from their output. |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 """ |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 |
|
45468
1d84bf5f9478
Patch #2167 from calvin: Remove unused imports
Christian Heimes <christian@cheimes.de>
parents:
33074
diff
changeset
|
37 import sys, errno, getopt, re |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 |
| 7735 | 39 sep1 = '='*77 + '\n' # file separator |
| 40 sep2 = '-'*28 + '\n' # revision separator | |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 def main(): |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 """Main program""" |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 truncate_last = 0 |
| 11762 | 45 reverse = 0 |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
46 branch = None |
|
28701
42de50e192df
Finally added a -h option to print the module docstring and exit. ;)
Barry Warsaw <barry@python.org>
parents:
27133
diff
changeset
|
47 opts, args = getopt.getopt(sys.argv[1:], "trb:h") |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 for o, a in opts: |
| 7735 | 49 if o == '-t': |
| 50 truncate_last = 1 | |
| 11762 | 51 elif o == '-r': |
| 52 reverse = 1 | |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
53 elif o == '-b': |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
54 branch = a |
|
28701
42de50e192df
Finally added a -h option to print the module docstring and exit. ;)
Barry Warsaw <barry@python.org>
parents:
27133
diff
changeset
|
55 elif o == '-h': |
|
42de50e192df
Finally added a -h option to print the module docstring and exit. ;)
Barry Warsaw <barry@python.org>
parents:
27133
diff
changeset
|
56 print __doc__ |
|
42de50e192df
Finally added a -h option to print the module docstring and exit. ;)
Barry Warsaw <barry@python.org>
parents:
27133
diff
changeset
|
57 sys.exit(0) |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 database = [] |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 while 1: |
| 7735 | 60 chunk = read_chunk(sys.stdin) |
| 61 if not chunk: | |
| 62 break | |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
63 records = digest_chunk(chunk, branch) |
| 7735 | 64 if truncate_last: |
| 65 del records[-1] | |
| 66 database[len(database):] = records | |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 database.sort() |
| 11762 | 68 if not reverse: |
| 69 database.reverse() | |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 format_output(database) |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 def read_chunk(fp): |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 """Read a chunk -- data for one file, ending with sep1. |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
74 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 Split the chunk in parts separated by sep2. |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
76 |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 """ |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 chunk = [] |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
79 lines = [] |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
80 while 1: |
| 7735 | 81 line = fp.readline() |
| 82 if not line: | |
| 83 break | |
| 84 if line == sep1: | |
| 85 if lines: | |
| 86 chunk.append(lines) | |
| 87 break | |
| 88 if line == sep2: | |
| 89 if lines: | |
| 90 chunk.append(lines) | |
| 91 lines = [] | |
| 92 else: | |
| 93 lines.append(line) | |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
94 return chunk |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
96 def digest_chunk(chunk, branch=None): |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
97 """Digest a chunk -- extract working file name and revisions""" |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 lines = chunk[0] |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 key = 'Working file:' |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
100 keylen = len(key) |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 for line in lines: |
| 7735 | 102 if line[:keylen] == key: |
|
25219
8a7a2f1f88f0
Apply diff2.txt from SF patch http://www.python.org/sf/572113
Walter Dörwald <walter@livinglogic.de>
parents:
17363
diff
changeset
|
103 working_file = line[keylen:].strip() |
| 7735 | 104 break |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 else: |
| 7735 | 106 working_file = None |
|
27133
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
107 if branch is None: |
|
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
108 pass |
|
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
109 elif branch == "HEAD": |
|
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
110 branch = re.compile(r"^\d+\.\d+$") |
|
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
111 else: |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
112 revisions = {} |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
113 key = 'symbolic names:\n' |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
114 found = 0 |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
115 for line in lines: |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
116 if line == key: |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
117 found = 1 |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
118 elif found: |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
119 if line[0] in '\t ': |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
120 tag, rev = line.split() |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
121 if tag[-1] == ':': |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
122 tag = tag[:-1] |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
123 revisions[tag] = rev |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
124 else: |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
125 found = 0 |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
126 rev = revisions.get(branch) |
|
27133
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
127 branch = re.compile(r"^<>$") # <> to force a mismatch by default |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
128 if rev: |
|
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
129 if rev.find('.0.') >= 0: |
|
27133
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
130 rev = rev.replace('.0.', '.') |
|
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
131 branch = re.compile(r"^" + re.escape(rev) + r"\.\d+$") |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
132 records = [] |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
133 for lines in chunk[1:]: |
| 7735 | 134 revline = lines[0] |
| 135 dateline = lines[1] | |
| 136 text = lines[2:] | |
|
25219
8a7a2f1f88f0
Apply diff2.txt from SF patch http://www.python.org/sf/572113
Walter Dörwald <walter@livinglogic.de>
parents:
17363
diff
changeset
|
137 words = dateline.split() |
| 7735 | 138 author = None |
| 139 if len(words) >= 3 and words[0] == 'date:': | |
| 140 dateword = words[1] | |
| 141 timeword = words[2] | |
| 142 if timeword[-1:] == ';': | |
| 143 timeword = timeword[:-1] | |
| 144 date = dateword + ' ' + timeword | |
| 145 if len(words) >= 5 and words[3] == 'author:': | |
| 146 author = words[4] | |
| 147 if author[-1:] == ';': | |
| 148 author = author[:-1] | |
| 149 else: | |
| 150 date = None | |
| 151 text.insert(0, revline) | |
|
25219
8a7a2f1f88f0
Apply diff2.txt from SF patch http://www.python.org/sf/572113
Walter Dörwald <walter@livinglogic.de>
parents:
17363
diff
changeset
|
152 words = revline.split() |
| 7735 | 153 if len(words) >= 2 and words[0] == 'revision': |
| 154 rev = words[1] | |
| 155 else: | |
|
27133
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
156 # No 'revision' line -- weird... |
| 7735 | 157 rev = None |
| 158 text.insert(0, revline) | |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
159 if branch: |
|
27133
49bcfecb2962
Use regular expressions for branch matching, to avoid including
Guido van Rossum <guido@python.org>
parents:
25481
diff
changeset
|
160 if rev is None or not branch.match(rev): |
|
25481
21444bdcb09c
Added -b tag option to limit output to a specific branch only.
Guido van Rossum <guido@python.org>
parents:
25219
diff
changeset
|
161 continue |
| 7735 | 162 records.append((date, working_file, rev, author, text)) |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
163 return records |
|
15930
14a27acc755a
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
11762
diff
changeset
|
164 |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
165 def format_output(database): |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
166 prevtext = None |
|
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 prev = [] |
|
6404
ed6f6f032217
Fix comment to add the all-important trailing colon to the example.
Guido van Rossum <guido@python.org>
parents:
6051
diff
changeset
|
168 database.append((None, None, None, None, None)) # Sentinel |
|
ed6f6f032217
Fix comment to add the all-important trailing colon to the example.
Guido van Rossum <guido@python.org>
parents:
6051
diff
changeset
|
169 for (date, working_file, rev, author, text) in database: |
| 7735 | 170 if text != prevtext: |
| 171 if prev: | |
| 172 print sep2, | |
| 173 for (p_date, p_working_file, p_rev, p_author) in prev: | |
|
17363
d109ec667ec2
Append the revision number for each file to the output.
Guido van Rossum <guido@python.org>
parents:
15930
diff
changeset
|
174 print p_date, p_author, p_working_file, p_rev |
| 7735 | 175 sys.stdout.writelines(prevtext) |
| 176 prev = [] | |
| 177 prev.append((date, working_file, rev, author)) | |
| 178 prevtext = text | |
|
6045
6eb1e3549e2d
Consolidate a bunch of CVS or RCS logs read from stdin.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
179 |
|
33074
981fff7363b9
[Patch #1005491 ] use __name__ == '__main__' in scripts
Andrew M. Kuchling <amk@amk.ca>
parents:
30144
diff
changeset
|
180 if __name__ == '__main__': |
|
981fff7363b9
[Patch #1005491 ] use __name__ == '__main__' in scripts
Andrew M. Kuchling <amk@amk.ca>
parents:
30144
diff
changeset
|
181 try: |
|
981fff7363b9
[Patch #1005491 ] use __name__ == '__main__' in scripts
Andrew M. Kuchling <amk@amk.ca>
parents:
30144
diff
changeset
|
182 main() |
|
981fff7363b9
[Patch #1005491 ] use __name__ == '__main__' in scripts
Andrew M. Kuchling <amk@amk.ca>
parents:
30144
diff
changeset
|
183 except IOError, e: |
|
981fff7363b9
[Patch #1005491 ] use __name__ == '__main__' in scripts
Andrew M. Kuchling <amk@amk.ca>
parents:
30144
diff
changeset
|
184 if e.errno != errno.EPIPE: |
|
981fff7363b9
[Patch #1005491 ] use __name__ == '__main__' in scripts
Andrew M. Kuchling <amk@amk.ca>
parents:
30144
diff
changeset
|
185 raise |
