comparison hgweb.py @ 99:db5eb6a86179

making change list be reverse ordered adding link to revision in change list changing revision links to display checkin
author jake@edge2.net
date Fri, 13 May 2005 17:27:14 -0700
parents 1215bf60468f
children 526722d24ee5
comparison
equal deleted inserted replaced
67:a182f2561c8e 99:db5eb6a86179
54 print '</BODY>' 54 print '</BODY>'
55 print '</HTML>' 55 print '</HTML>'
56 56
57 57
58 58
59 def ent_change(repo, nodeid): 59 def ent_change(repo, nodeid, changes):
60 changes = repo.changelog.read(nodeid)
61 hn = hg.hex(nodeid) 60 hn = hg.hex(nodeid)
62 i = repo.changelog.rev(nodeid) 61 i = repo.changelog.rev(nodeid)
63 (h1, h2) = [ hg.hex(x) for x in repo.changelog.parents(nodeid) ] 62 (h1, h2) = [ hg.hex(x) for x in repo.changelog.parents(nodeid) ]
64 datestr = time.asctime(time.gmtime(float(changes[2].split(' ')[0]))) 63 datestr = time.asctime(time.gmtime(float(changes[2].split(' ')[0])))
65 print '<table width="100%" border="1">' 64 print '<table width="100%" border="1">'
72 print '\t<tr><td>date:</td><td>%s UTC</td>' % (datestr, ) 71 print '\t<tr><td>date:</td><td>%s UTC</td>' % (datestr, )
73 print '\t\t<td valign="top">files:</td><td valign="top">' 72 print '\t\t<td valign="top">files:</td><td valign="top">'
74 for f in changes[3]: 73 for f in changes[3]:
75 print '\t\t%s&nbsp;&nbsp;' % f 74 print '\t\t%s&nbsp;&nbsp;' % f
76 print '\t</td></tr>' 75 print '\t</td></tr>'
77 # print '\t<tr><td>revision:</td><td colspan="3">%d:<a ' % (i, ) + \ 76 print '\t<tr><td>revision:</td><td colspan="3">%d:<a ' % (i, ) + \
78 # 'href="?cmd=rev;nd=%s">%s</a></td></tr>' % (hn, hn, ) 77 'href="?cmd=chkin;nd=%s">%s</a></td></tr>' % (hn, hn, )
79 print '</table><br />' 78 print '</table><br />'
80 79
81 def ent_diff(a, b, fn): 80 def ent_diff(a, b, fn):
82 a = a.splitlines(1) 81 a = a.splitlines(1)
83 b = b.splitlines(1) 82 b = b.splitlines(1)
106 (i1, i2) = [ repo.changelog.rev(x) for x in parents ] 105 (i1, i2) = [ repo.changelog.rev(x) for x in parents ]
107 datestr = time.asctime(time.gmtime(float(changes[2].split(' ')[0]))) 106 datestr = time.asctime(time.gmtime(float(changes[2].split(' ')[0])))
108 mf = repo.manifest.read(changes[0]) 107 mf = repo.manifest.read(changes[0])
109 print '<table width="100%" border="1">' 108 print '<table width="100%" border="1">'
110 print '\t<tr><td>revision:</td><td colspan="3">%d:' % (i, ), 109 print '\t<tr><td>revision:</td><td colspan="3">%d:' % (i, ),
111 print '<a href="?cmd=rev;nd=%s">%s</a></td></tr>' % (hn, hn, ) 110 print '<a href="?cmd=chkin;nd=%s">%s</a></td></tr>' % (hn, hn, )
112 print '\t<tr><td>parent(s):</td><td colspan="3">%d:' % (i1, ) 111 print '\t<tr><td>parent(s):</td><td colspan="3">%d:' % (i1, )
113 print '<a href="?cmd=rev;nd=%s">%s</a>' % (h1, h1, ), 112 print '<a href="?cmd=chkin;nd=%s">%s</a>' % (h1, h1, ),
114 if i2 != -1: 113 if i2 != -1:
115 print '&nbsp;&nbsp;%d:<a href="?cmd=rev;nd=%s">%s</a>' % \ 114 print '&nbsp;&nbsp;%d:<a href="?cmd=chkin;nd=%s">%s</a>' % \
116 (i2, h2, h2, ), 115 (i2, h2, h2, ),
117 else: 116 else:
118 print '&nbsp;&nbsp;%d:%s' % (i2, h2, ), 117 print '&nbsp;&nbsp;%d:%s' % (i2, h2, ),
119 print '</td></tr>' 118 print '</td></tr>'
120 print '\t<tr><td>manifest:</td><td colspan="3">%d:' % \ 119 print '\t<tr><td>manifest:</td><td colspan="3">%d:' % \
156 print '</pre>' 155 print '</pre>'
157 156
158 def change_page(): 157 def change_page():
159 startpage("Mercurial Web") 158 startpage("Mercurial Web")
160 print '<table width="100%" align="center">' 159 print '<table width="100%" align="center">'
161 for i in xrange(0, repo.changelog.count()): 160 cl = []
161 for i in xrange(repo.changelog.count()):
162 n = repo.changelog.node(i) 162 n = repo.changelog.node(i)
163 cl.append((n, repo.changelog.read(n)))
164 cl.reverse()
165 for n, ch in cl:
163 print '<tr><td>' 166 print '<tr><td>'
164 ent_change(repo, n) 167 ent_change(repo, n, ch)
165 print '</td></th>' 168 print '</td></th>'
166 169
167 print '</table>' 170 print '</table>'
168 endpage() 171 endpage()
169 172