[cfe-commits] r56470 - /cfe/trunk/tools/scan-view/ScanView.py
Daniel Dunbar
daniel at zuster.org
Mon Sep 22 14:43:58 PDT 2008
Author: ddunbar
Date: Mon Sep 22 16:43:43 2008
New Revision: 56470
URL: http://llvm.org/viewvc/llvm-project?rev=56470&view=rev
Log:
scan-view: Add header and "report bug" links to report pages.
Modified:
cfe/trunk/tools/scan-view/ScanView.py
Modified: cfe/trunk/tools/scan-view/ScanView.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/ScanView.py?rev=56470&r1=56469&r2=56470&view=diff
==============================================================================
--- cfe/trunk/tools/scan-view/ScanView.py (original)
+++ cfe/trunk/tools/scan-view/ScanView.py Mon Sep 22 16:43:43 2008
@@ -14,7 +14,10 @@
import Reporter
import ConfigParser
-# Keys replaced by server.
+###
+# Various patterns matched or replaced by server.
+
+kReportFileRE = re.compile('(.*/)?report-(.*)\\.html')
kBugKeyValueRE = re.compile('<!-- BUG([^ ]*) (.*) -->')
@@ -45,6 +48,12 @@
('<td class="Button"><a href="report/\\1">Report Bug</a></td>' +
'<td class="Button"><a href="javascript:load(\'open/\\1\')">Open File</a></td>')))
+kReportReplacements.append((re.compile('<!-- REPORTHEADER -->'),
+ '<h3><a href="/">Summary</a> > Report %(report)s</h3>'))
+
+kReportReplacements.append((re.compile('<!-- REPORTSUMMARYEXTRA -->'),
+ '<td class="Button"><a href="report/%(report)s">Report Bug</a></td>'))
+
###
# Other simple parameters
@@ -570,6 +579,13 @@
return StringIO.StringIO(s)
def send_patched_file(self, path, ctype):
+ # Allow a very limited set of variables. This is pretty gross.
+ variables = {}
+ variables['report'] = ''
+ m = kReportFileRE.match(path)
+ if m:
+ variables['report'] = m.group(2)
+
try:
f = open(path,'r')
except IOError:
@@ -577,7 +593,7 @@
fs = os.fstat(f.fileno())
data = f.read()
for a,b in kReportReplacements:
- data = a.sub(b, data)
+ data = a.sub(b % variables, data)
return self.send_string(data, ctype, mtime=fs.st_mtime)
More information about the cfe-commits
mailing list