Quellcode durchsuchen

Don't write duplicate entries to files_by_date.dat.

Heikki Hokkanen vor 16 Jahren
Ursprung
Commit
cc7a07e9fb
1 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen
  1. 9
    2
      gitstats

+ 9
- 2
gitstats Datei anzeigen

@@ -778,9 +778,16 @@ class HTMLReportCreator(ReportCreator):
778 778
 		# Files :: File count by date
779 779
 		f.write(html_header(2, 'File count by date'))
780 780
 
781
-		fg = open(path + '/files_by_date.dat', 'w')
781
+		# use set to get rid of duplicate/unnecessary entries
782
+		files_by_date = set()
782 783
 		for stamp in sorted(data.files_by_stamp.keys()):
783
-			fg.write('%s %d\n' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp]))
784
+			files_by_date.add('%s %d' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp]))
785
+
786
+		fg = open(path + '/files_by_date.dat', 'w')
787
+		for line in sorted(list(files_by_date)):
788
+			fg.write('%s\n' % line)
789
+		#for stamp in sorted(data.files_by_stamp.keys()):
790
+		#	fg.write('%s %d\n' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp]))
784 791
 		fg.close()
785 792
 			
786 793
 		f.write('<img src="files_by_date.png" alt="Files by Date" />')