From d35d073c1e1a80fa3cf350022776a4bf7cf31a37 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Sun, 9 May 2010 21:06:00 +0200 Subject: [PATCH] - simplify "get_commit_message_template()" --- osc/core.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/osc/core.py b/osc/core.py index f12dc891..b9446180 100644 --- a/osc/core.py +++ b/osc/core.py @@ -4626,19 +4626,16 @@ def get_commit_message_template(pac): """ diff = "" template = [] - if pac.todo: - files = filter(lambda file: '.changes' in file and pac.status(file) in ('A', 'M'), pac.todo) - if not files: - return template + files = [i for i in pac.todo if i.endswith('.changes') and pac.status(i) in ('A', 'M')] - for file in files: - if pac.status(file) == 'M': - diff += get_source_file_diff(pac.absdir, file, pac.rev) - elif pac.status(file) == 'A': - f = open(file, 'r') - for line in f: - diff += '+' + line - f.close() + for file in files: + if pac.status(file) == 'M': + diff += get_source_file_diff(pac.absdir, file, pac.rev) + elif pac.status(file) == 'A': + f = open(file, 'r') + for line in f: + diff += '+' + line + f.close() if diff: template = parse_diff_for_commit_message(diff)