Преглед на файлове

General: show total lines added/removed.

Heikki Hokkanen преди 16 години
родител
ревизия
b4764d471b
променени са 1 файла, в които са добавени 8 реда и са изтрити 1 реда
  1. 8
    1
      gitstats

+ 8
- 1
gitstats Целия файл

@@ -174,6 +174,11 @@ class GitDataCollector(DataCollector):
174 174
 		self.last_active_day = None
175 175
 		self.active_days = set()
176 176
 
177
+		# lines
178
+		self.total_lines = 0
179
+		self.total_lines_added = 0
180
+		self.total_lines_removed = 0
181
+
177 182
 		# timezone
178 183
 		self.commits_by_timezone = {} # timezone -> commits
179 184
 
@@ -390,6 +395,8 @@ class GitDataCollector(DataCollector):
390 395
 					(files, inserted, deleted) = map(lambda el : int(el), numbers)
391 396
 					total_lines += inserted
392 397
 					total_lines -= deleted
398
+					self.total_lines_added += inserted
399
+					self.total_lines_removed += deleted
393 400
 				else:
394 401
 					print 'Warning: failed to handle line "%s"' % line
395 402
 					(files, inserted, deleted) = (0, 0, 0)
@@ -520,7 +527,7 @@ class HTMLReportCreator(ReportCreator):
520 527
 		f.write('<dt>Generator</dt><dd><a href="http://gitstats.sourceforge.net/">GitStats</a> (version %s)</dd>' % getversion())
521 528
 		f.write('<dt>Report Period</dt><dd>%s to %s (%d days, %d active days)</dd>' % (data.getFirstCommitDate().strftime(format), data.getLastCommitDate().strftime(format), data.getCommitDeltaDays(), len(data.getActiveDays())))
522 529
 		f.write('<dt>Total Files</dt><dd>%s</dd>' % data.getTotalFiles())
523
-		f.write('<dt>Total Lines of Code</dt><dd>%s</dd>' % data.getTotalLOC())
530
+		f.write('<dt>Total Lines of Code</dt><dd>%s (%d added, %d removed)</dd>' % (data.getTotalLOC(), data.total_lines_added, data.total_lines_removed))
524 531
 		f.write('<dt>Total Commits</dt><dd>%s</dd>' % data.getTotalCommits())
525 532
 		f.write('<dt>Authors</dt><dd>%s</dd>' % data.getTotalAuthors())
526 533
 		f.write('</dl>')