From c63cb02920ee99ba3508eba69b6df284b2294023 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 14 Feb 2016 14:20:30 +0200 Subject: Only do one replace --- bumper | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bumper b/bumper index 4a60257..a3d6d4f 100755 --- a/bumper +++ b/bumper @@ -92,7 +92,7 @@ class Bumper(cliapp.Application): date = time.strftime('%Y-%m-%d') pattern = r'^Version \d+(\.\d+)*(\+git)?, not yet released$' replacement = 'Version {}, released {}'.format(version, date) - updated = re.sub(pattern, replacement, text, flags=re.M) + updated = re.sub(pattern, replacement, text, count=1, flags=re.M) with open('NEWS', 'w') as f: f.write(updated) @@ -101,7 +101,7 @@ class Bumper(cliapp.Application): text = f.read() pattern = r'^Version \d+(\.\d+)*, released \d\d\d\d-\d\d-\d\d$' replacement = 'Version {}, not yet released'.format(version) - updated = re.sub(pattern, replacement, text, flags=re.M) + updated = re.sub(pattern, replacement, text, count=1, flags=re.M) with open('NEWS', 'w') as f: f.write(updated) -- cgit v1.2.1