From cc7a07e9fba287270878450760b600a49b6c9c88 Mon Sep 17 00:00:00 2001 From: Heikki Hokkanen Date: Fri, 25 Dec 2009 11:51:12 +0200 Subject: [PATCH] Don't write duplicate entries to files_by_date.dat. --- gitstats | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gitstats b/gitstats index a305549..a5578cd 100755 --- a/gitstats +++ b/gitstats @@ -778,9 +778,16 @@ class HTMLReportCreator(ReportCreator): # Files :: File count by date f.write(html_header(2, 'File count by date')) - fg = open(path + '/files_by_date.dat', 'w') + # use set to get rid of duplicate/unnecessary entries + files_by_date = set() for stamp in sorted(data.files_by_stamp.keys()): - fg.write('%s %d\n' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp])) + files_by_date.add('%s %d' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp])) + + fg = open(path + '/files_by_date.dat', 'w') + for line in sorted(list(files_by_date)): + fg.write('%s\n' % line) + #for stamp in sorted(data.files_by_stamp.keys()): + # fg.write('%s %d\n' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp])) fg.close() f.write('Files by Date') -- 2.11.4.GIT