with open('NEWS.md', 'r', encoding='utf-8') as fh:
for line in fh:
- if not last_version:
- m = re.search(r'rsync (\d+\.\d+\.\d+).*\d\d\d\d', line)
+ if not last_version: # Find the first non-dev|pre version with a release date.
+ m = re.search(r'rsync (\d+\.\d+\.\d+) .*\d\d\d\d', line)
if m:
last_version = m[1]
m = rel_re.match(line)
elif fn == 'NEWS.md':
efv = re.escape(finalversion)
x_re = re.compile(r'^---+\n<.+>\s+# NEWS .+\s+Protocol: .+\n')
- rel_day = 'UNRELEASED' if pre else today
- repl = ('-'*78 + f'\n<a name="{version}"></a>\n\n# NEWS for rsync {version} ({rel_day})\n\n'
+ repl = ('-'*78 + f'\n<a name="{version}"></a>\n\n# NEWS for rsync {version} ({today})\n\n'
+ f"Protocol: {protocol_version} ({proto_changed})\n")
msg = f"The top lines of {fn} are not in the right format. They must be:\n" + repl
txt = replace_or_die(x_re, repl, txt, msg)