|
|
|
|
|
|
38
|
# This should be the main function to extract data from the repository.
|
38
|
# This should be the main function to extract data from the repository.
|
|
39
|
def collect(self, dir):
|
39
|
def collect(self, dir):
|
|
40
|
self.dir = dir
|
40
|
self.dir = dir
|
|
|
|
41
|
+ self.projectname = os.path.basename(os.path.abspath(dir))
|
|
41
|
|
42
|
|
|
42
|
##
|
43
|
##
|
|
43
|
# : get a dictionary of author
|
44
|
# : get a dictionary of author
|
|
|
|
|
|
|
344
|
class HTMLReportCreator(ReportCreator):
|
345
|
class HTMLReportCreator(ReportCreator):
|
|
345
|
def create(self, data, path):
|
346
|
def create(self, data, path):
|
|
346
|
ReportCreator.create(self, data, path)
|
347
|
ReportCreator.create(self, data, path)
|
|
|
|
348
|
+ self.title = data.projectname
|
|
347
|
|
349
|
|
|
348
|
# TODO copy the CSS if it does not exist
|
350
|
# TODO copy the CSS if it does not exist
|
|
349
|
if not os.path.exists(path + '/gitstats.css'):
|
351
|
if not os.path.exists(path + '/gitstats.css'):
|
|
|
|
|
|
|
354
|
format = '%Y-%m-%d %H:%m:%S'
|
356
|
format = '%Y-%m-%d %H:%m:%S'
|
|
355
|
self.printHeader(f)
|
357
|
self.printHeader(f)
|
|
356
|
|
358
|
|
|
357
|
- f.write('<h1>GitStats</h1>')
|
|
|
|
|
|
359
|
+ f.write('<h1>GitStats - %s</h1>' % data.projectname)
|
|
358
|
|
360
|
|
|
359
|
self.printNav(f)
|
361
|
self.printNav(f)
|
|
360
|
|
362
|
|
|
361
|
f.write('<dl>');
|
363
|
f.write('<dl>');
|
|
|
|
364
|
+ f.write('<dt>Project name</dt><dd>%s</dd>' % (data.projectname))
|
|
362
|
f.write('<dt>Generated</dt><dd>%s (in %d seconds)</dd>' % (datetime.datetime.now().strftime(format), time.time() - data.getStampCreated()));
|
365
|
f.write('<dt>Generated</dt><dd>%s (in %d seconds)</dd>' % (datetime.datetime.now().strftime(format), time.time() - data.getStampCreated()));
|
|
363
|
f.write('<dt>Report Period</dt><dd>%s to %s</dd>' % (data.getFirstCommitDate().strftime(format), data.getLastCommitDate().strftime(format)))
|
366
|
f.write('<dt>Report Period</dt><dd>%s to %s</dd>' % (data.getFirstCommitDate().strftime(format), data.getLastCommitDate().strftime(format)))
|
|
364
|
f.write('<dt>Total Files</dt><dd>%s</dd>' % data.getTotalFiles())
|
367
|
f.write('<dt>Total Files</dt><dd>%s</dd>' % data.getTotalFiles())
|
|
|
|
|
|
|
745
|
if len(out) > 0:
|
748
|
if len(out) > 0:
|
|
746
|
print out
|
749
|
print out
|
|
747
|
|
750
|
|
|
748
|
- def printHeader(self, f):
|
|
|
|
|
|
751
|
+ def printHeader(self, f, title = ''):
|
|
749
|
f.write(
|
752
|
f.write(
|
|
750
|
"""<?xml version="1.0" encoding="UTF-8"?>
|
753
|
"""<?xml version="1.0" encoding="UTF-8"?>
|
|
751
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
754
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
752
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
755
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
753
|
<head>
|
756
|
<head>
|
|
754
|
- <title>GitStats</title>
|
|
|
|
|
|
757
|
+ <title>GitStats - %s</title>
|
|
755
|
<link rel="stylesheet" href="gitstats.css" type="text/css" />
|
758
|
<link rel="stylesheet" href="gitstats.css" type="text/css" />
|
|
756
|
<meta name="generator" content="GitStats" />
|
759
|
<meta name="generator" content="GitStats" />
|
|
757
|
</head>
|
760
|
</head>
|
|
758
|
<body>
|
761
|
<body>
|
|
759
|
-""")
|
|
|
|
|
|
762
|
+""" % self.title)
|
|
760
|
|
763
|
|
|
761
|
def printNav(self, f):
|
764
|
def printNav(self, f):
|
|
762
|
f.write("""
|
765
|
f.write("""
|