71
70
# IVLE handler environment.
73
72
req = cgirequest.CGIRequest()
76
print("Content-Type: text/html\n")
73
req.content_type = "text/html"
79
75
# Beginning of the page
80
print('<div id="ivle_padding">')
81
print('<h1>Diff</h1>')
76
req.write('<div id="ivle_padding">\n')
77
req.write('<h1>Diff</h1>\n')
83
79
# Work out the revisions from query
84
url = urlparse.urlparse(req.path)
87
query = parse_qs(querystr)
80
fields = req.get_fieldstorage()
81
field_r = fields.getlist("r")
88
82
# Default revisions
89
83
rev1=pysvn.Revision( pysvn.opt_revision_kind.base )
90
84
rev2=pysvn.Revision( pysvn.opt_revision_kind.working )
92
if len(query['r']) == 2:
93
r2 = get_revision(query['r'][1])
85
# Override revisions from query string
87
r1 = get_revision(field_r[0])
91
r2 = get_revision(field_r[1])
96
r1 = get_revision(query['r'][0])
100
95
# Attempt to get the diff for these revisons
102
97
svnclient = pysvn.Client()
103
98
diff = svnclient.diff
104
99
diff_text = diff( '/tmp/svndiff',
105
path.join('/home/', urlpath),
100
path.join('/home/', req.path),
107
102
#revision1=pysvn.Revision( pysvn.opt_revision_kind.base ),
108
103
#url_or_path2=url_or_path,
123
118
split_diff = diff_matcher.findall(diff_text)
127
122
for filediff in split_diff:
128
123
filename = filediff[0]
129
124
diffbody = htmlfy_diff(filediff[1])
130
print("<dt><strong>File:</strong> " + filename + "</dt>")
131
print("<dd><code><pre>" + diffbody + "</pre></code></dd>")
125
req.write("<dt><strong>File:</strong> " + filename + "</dt>\n")
126
req.write("<dd><code><pre>" + diffbody + "</pre></code></dd>\n")
134
129
except pysvn._pysvn_2_5.ClientError, e:
135
print("<dl><dt><strong>Error:</strong></dt><dd>")
130
req.write("<dl><dt><strong>Error:</strong></dt><dd>\n")
132
req.write("</dd></dl>\n")
134
req.write('</div>\n')