Show More
@@ -1,658 +1,658 b'' | |||||
1 | # |
|
1 | # | |
2 | # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net> |
|
2 | # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net> | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2, incorporated herein by reference. |
|
6 | # GNU General Public License version 2, incorporated herein by reference. | |
7 |
|
7 | |||
8 | import os, mimetypes, re, cgi, copy |
|
8 | import os, mimetypes, re, cgi, copy | |
9 | import webutil |
|
9 | import webutil | |
10 | from mercurial import error, archival, templater, templatefilters |
|
10 | from mercurial import error, archival, templater, templatefilters | |
11 | from mercurial.node import short, hex |
|
11 | from mercurial.node import short, hex | |
12 | from mercurial.util import binary |
|
12 | from mercurial.util import binary | |
13 | from common import paritygen, staticfile, get_contact, ErrorResponse |
|
13 | from common import paritygen, staticfile, get_contact, ErrorResponse | |
14 | from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND |
|
14 | from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND | |
15 | from mercurial import graphmod, util |
|
15 | from mercurial import graphmod, util | |
16 |
|
16 | |||
17 | # __all__ is populated with the allowed commands. Be sure to add to it if |
|
17 | # __all__ is populated with the allowed commands. Be sure to add to it if | |
18 | # you're adding a new command, or the new command won't work. |
|
18 | # you're adding a new command, or the new command won't work. | |
19 |
|
19 | |||
20 | __all__ = [ |
|
20 | __all__ = [ | |
21 | 'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev', |
|
21 | 'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev', | |
22 | 'manifest', 'tags', 'summary', 'filediff', 'diff', 'annotate', 'filelog', |
|
22 | 'manifest', 'tags', 'summary', 'filediff', 'diff', 'annotate', 'filelog', | |
23 | 'archive', 'static', 'graph', |
|
23 | 'archive', 'static', 'graph', | |
24 | ] |
|
24 | ] | |
25 |
|
25 | |||
26 | def log(web, req, tmpl): |
|
26 | def log(web, req, tmpl): | |
27 | if 'file' in req.form and req.form['file'][0]: |
|
27 | if 'file' in req.form and req.form['file'][0]: | |
28 | return filelog(web, req, tmpl) |
|
28 | return filelog(web, req, tmpl) | |
29 | else: |
|
29 | else: | |
30 | return changelog(web, req, tmpl) |
|
30 | return changelog(web, req, tmpl) | |
31 |
|
31 | |||
32 | def rawfile(web, req, tmpl): |
|
32 | def rawfile(web, req, tmpl): | |
33 | path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) |
|
33 | path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) | |
34 | if not path: |
|
34 | if not path: | |
35 | content = manifest(web, req, tmpl) |
|
35 | content = manifest(web, req, tmpl) | |
36 | req.respond(HTTP_OK, web.ctype) |
|
36 | req.respond(HTTP_OK, web.ctype) | |
37 | return content |
|
37 | return content | |
38 |
|
38 | |||
39 | try: |
|
39 | try: | |
40 | fctx = webutil.filectx(web.repo, req) |
|
40 | fctx = webutil.filectx(web.repo, req) | |
41 | except error.LookupError, inst: |
|
41 | except error.LookupError, inst: | |
42 | try: |
|
42 | try: | |
43 | content = manifest(web, req, tmpl) |
|
43 | content = manifest(web, req, tmpl) | |
44 | req.respond(HTTP_OK, web.ctype) |
|
44 | req.respond(HTTP_OK, web.ctype) | |
45 | return content |
|
45 | return content | |
46 | except ErrorResponse: |
|
46 | except ErrorResponse: | |
47 | raise inst |
|
47 | raise inst | |
48 |
|
48 | |||
49 | path = fctx.path() |
|
49 | path = fctx.path() | |
50 | text = fctx.data() |
|
50 | text = fctx.data() | |
51 | mt = mimetypes.guess_type(path)[0] |
|
51 | mt = mimetypes.guess_type(path)[0] | |
52 | if mt is None: |
|
52 | if mt is None: | |
53 | mt = binary(text) and 'application/octet-stream' or 'text/plain' |
|
53 | mt = binary(text) and 'application/octet-stream' or 'text/plain' | |
54 |
|
54 | |||
55 | req.respond(HTTP_OK, mt, path, len(text)) |
|
55 | req.respond(HTTP_OK, mt, path, len(text)) | |
56 | return [text] |
|
56 | return [text] | |
57 |
|
57 | |||
58 | def _filerevision(web, tmpl, fctx): |
|
58 | def _filerevision(web, tmpl, fctx): | |
59 | f = fctx.path() |
|
59 | f = fctx.path() | |
60 | text = fctx.data() |
|
60 | text = fctx.data() | |
61 | parity = paritygen(web.stripecount) |
|
61 | parity = paritygen(web.stripecount) | |
62 |
|
62 | |||
63 | if binary(text): |
|
63 | if binary(text): | |
64 | mt = mimetypes.guess_type(f)[0] or 'application/octet-stream' |
|
64 | mt = mimetypes.guess_type(f)[0] or 'application/octet-stream' | |
65 | text = '(binary:%s)' % mt |
|
65 | text = '(binary:%s)' % mt | |
66 |
|
66 | |||
67 | def lines(): |
|
67 | def lines(): | |
68 | for lineno, t in enumerate(text.splitlines(1)): |
|
68 | for lineno, t in enumerate(text.splitlines(1)): | |
69 | yield {"line": t, |
|
69 | yield {"line": t, | |
70 | "lineid": "l%d" % (lineno + 1), |
|
70 | "lineid": "l%d" % (lineno + 1), | |
71 | "linenumber": "% 6d" % (lineno + 1), |
|
71 | "linenumber": "% 6d" % (lineno + 1), | |
72 | "parity": parity.next()} |
|
72 | "parity": parity.next()} | |
73 |
|
73 | |||
74 | return tmpl("filerevision", |
|
74 | return tmpl("filerevision", | |
75 | file=f, |
|
75 | file=f, | |
76 | path=webutil.up(f), |
|
76 | path=webutil.up(f), | |
77 | text=lines(), |
|
77 | text=lines(), | |
78 | rev=fctx.rev(), |
|
78 | rev=fctx.rev(), | |
79 | node=hex(fctx.node()), |
|
79 | node=hex(fctx.node()), | |
80 | author=fctx.user(), |
|
80 | author=fctx.user(), | |
81 | date=fctx.date(), |
|
81 | date=fctx.date(), | |
82 | desc=fctx.description(), |
|
82 | desc=fctx.description(), | |
83 | branch=webutil.nodebranchnodefault(fctx), |
|
83 | branch=webutil.nodebranchnodefault(fctx), | |
84 | parent=webutil.parents(fctx), |
|
84 | parent=webutil.parents(fctx), | |
85 | child=webutil.children(fctx), |
|
85 | child=webutil.children(fctx), | |
86 | rename=webutil.renamelink(fctx), |
|
86 | rename=webutil.renamelink(fctx), | |
87 | permissions=fctx.manifest().flags(f)) |
|
87 | permissions=fctx.manifest().flags(f)) | |
88 |
|
88 | |||
89 | def file(web, req, tmpl): |
|
89 | def file(web, req, tmpl): | |
90 | path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) |
|
90 | path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) | |
91 | if not path: |
|
91 | if not path: | |
92 | return manifest(web, req, tmpl) |
|
92 | return manifest(web, req, tmpl) | |
93 | try: |
|
93 | try: | |
94 | return _filerevision(web, tmpl, webutil.filectx(web.repo, req)) |
|
94 | return _filerevision(web, tmpl, webutil.filectx(web.repo, req)) | |
95 | except error.LookupError, inst: |
|
95 | except error.LookupError, inst: | |
96 | try: |
|
96 | try: | |
97 | return manifest(web, req, tmpl) |
|
97 | return manifest(web, req, tmpl) | |
98 | except ErrorResponse: |
|
98 | except ErrorResponse: | |
99 | raise inst |
|
99 | raise inst | |
100 |
|
100 | |||
101 | def _search(web, tmpl, query): |
|
101 | def _search(web, tmpl, query): | |
102 |
|
102 | |||
103 | def changelist(**map): |
|
103 | def changelist(**map): | |
104 | cl = web.repo.changelog |
|
104 | cl = web.repo.changelog | |
105 | count = 0 |
|
105 | count = 0 | |
106 | qw = query.lower().split() |
|
106 | qw = query.lower().split() | |
107 |
|
107 | |||
108 | def revgen(): |
|
108 | def revgen(): | |
109 | for i in xrange(len(cl) - 1, 0, -100): |
|
109 | for i in xrange(len(cl) - 1, 0, -100): | |
110 | l = [] |
|
110 | l = [] | |
111 | for j in xrange(max(0, i - 100), i + 1): |
|
111 | for j in xrange(max(0, i - 100), i + 1): | |
112 | ctx = web.repo[j] |
|
112 | ctx = web.repo[j] | |
113 | l.append(ctx) |
|
113 | l.append(ctx) | |
114 | l.reverse() |
|
114 | l.reverse() | |
115 | for e in l: |
|
115 | for e in l: | |
116 | yield e |
|
116 | yield e | |
117 |
|
117 | |||
118 | for ctx in revgen(): |
|
118 | for ctx in revgen(): | |
119 | miss = 0 |
|
119 | miss = 0 | |
120 | for q in qw: |
|
120 | for q in qw: | |
121 | if not (q in ctx.user().lower() or |
|
121 | if not (q in ctx.user().lower() or | |
122 | q in ctx.description().lower() or |
|
122 | q in ctx.description().lower() or | |
123 | q in " ".join(ctx.files()).lower()): |
|
123 | q in " ".join(ctx.files()).lower()): | |
124 | miss = 1 |
|
124 | miss = 1 | |
125 | break |
|
125 | break | |
126 | if miss: |
|
126 | if miss: | |
127 | continue |
|
127 | continue | |
128 |
|
128 | |||
129 | count += 1 |
|
129 | count += 1 | |
130 | n = ctx.node() |
|
130 | n = ctx.node() | |
131 | showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) |
|
131 | showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) | |
132 | files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) |
|
132 | files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) | |
133 |
|
133 | |||
134 | yield tmpl('searchentry', |
|
134 | yield tmpl('searchentry', | |
135 | parity=parity.next(), |
|
135 | parity=parity.next(), | |
136 | author=ctx.user(), |
|
136 | author=ctx.user(), | |
137 | parent=webutil.parents(ctx), |
|
137 | parent=webutil.parents(ctx), | |
138 | child=webutil.children(ctx), |
|
138 | child=webutil.children(ctx), | |
139 | changelogtag=showtags, |
|
139 | changelogtag=showtags, | |
140 | desc=ctx.description(), |
|
140 | desc=ctx.description(), | |
141 | date=ctx.date(), |
|
141 | date=ctx.date(), | |
142 | files=files, |
|
142 | files=files, | |
143 | rev=ctx.rev(), |
|
143 | rev=ctx.rev(), | |
144 | node=hex(n), |
|
144 | node=hex(n), | |
145 | tags=webutil.nodetagsdict(web.repo, n), |
|
145 | tags=webutil.nodetagsdict(web.repo, n), | |
146 | inbranch=webutil.nodeinbranch(web.repo, ctx), |
|
146 | inbranch=webutil.nodeinbranch(web.repo, ctx), | |
147 | branches=webutil.nodebranchdict(web.repo, ctx)) |
|
147 | branches=webutil.nodebranchdict(web.repo, ctx)) | |
148 |
|
148 | |||
149 | if count >= web.maxchanges: |
|
149 | if count >= web.maxchanges: | |
150 | break |
|
150 | break | |
151 |
|
151 | |||
152 | cl = web.repo.changelog |
|
152 | cl = web.repo.changelog | |
153 | parity = paritygen(web.stripecount) |
|
153 | parity = paritygen(web.stripecount) | |
154 |
|
154 | |||
155 | return tmpl('search', |
|
155 | return tmpl('search', | |
156 | query=query, |
|
156 | query=query, | |
157 | node=hex(cl.tip()), |
|
157 | node=hex(cl.tip()), | |
158 | entries=changelist, |
|
158 | entries=changelist, | |
159 | archives=web.archivelist("tip")) |
|
159 | archives=web.archivelist("tip")) | |
160 |
|
160 | |||
161 | def changelog(web, req, tmpl, shortlog = False): |
|
161 | def changelog(web, req, tmpl, shortlog = False): | |
162 | if 'node' in req.form: |
|
162 | if 'node' in req.form: | |
163 | ctx = webutil.changectx(web.repo, req) |
|
163 | ctx = webutil.changectx(web.repo, req) | |
164 | else: |
|
164 | else: | |
165 | if 'rev' in req.form: |
|
165 | if 'rev' in req.form: | |
166 | hi = req.form['rev'][0] |
|
166 | hi = req.form['rev'][0] | |
167 | else: |
|
167 | else: | |
168 | hi = len(web.repo) - 1 |
|
168 | hi = len(web.repo) - 1 | |
169 | try: |
|
169 | try: | |
170 | ctx = web.repo[hi] |
|
170 | ctx = web.repo[hi] | |
171 | except error.RepoError: |
|
171 | except error.RepoError: | |
172 | return _search(web, tmpl, hi) # XXX redirect to 404 page? |
|
172 | return _search(web, tmpl, hi) # XXX redirect to 404 page? | |
173 |
|
173 | |||
174 | def changelist(limit=0, **map): |
|
174 | def changelist(limit=0, **map): | |
175 | l = [] # build a list in forward order for efficiency |
|
175 | l = [] # build a list in forward order for efficiency | |
176 | for i in xrange(start, end): |
|
176 | for i in xrange(start, end): | |
177 | ctx = web.repo[i] |
|
177 | ctx = web.repo[i] | |
178 | n = ctx.node() |
|
178 | n = ctx.node() | |
179 | showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) |
|
179 | showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) | |
180 | files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) |
|
180 | files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) | |
181 |
|
181 | |||
182 | l.insert(0, {"parity": parity.next(), |
|
182 | l.insert(0, {"parity": parity.next(), | |
183 | "author": ctx.user(), |
|
183 | "author": ctx.user(), | |
184 | "parent": webutil.parents(ctx, i - 1), |
|
184 | "parent": webutil.parents(ctx, i - 1), | |
185 | "child": webutil.children(ctx, i + 1), |
|
185 | "child": webutil.children(ctx, i + 1), | |
186 | "changelogtag": showtags, |
|
186 | "changelogtag": showtags, | |
187 | "desc": ctx.description(), |
|
187 | "desc": ctx.description(), | |
188 | "date": ctx.date(), |
|
188 | "date": ctx.date(), | |
189 | "files": files, |
|
189 | "files": files, | |
190 | "rev": i, |
|
190 | "rev": i, | |
191 | "node": hex(n), |
|
191 | "node": hex(n), | |
192 | "tags": webutil.nodetagsdict(web.repo, n), |
|
192 | "tags": webutil.nodetagsdict(web.repo, n), | |
193 | "inbranch": webutil.nodeinbranch(web.repo, ctx), |
|
193 | "inbranch": webutil.nodeinbranch(web.repo, ctx), | |
194 | "branches": webutil.nodebranchdict(web.repo, ctx) |
|
194 | "branches": webutil.nodebranchdict(web.repo, ctx) | |
195 | }) |
|
195 | }) | |
196 |
|
196 | |||
197 | if limit > 0: |
|
197 | if limit > 0: | |
198 | l = l[:limit] |
|
198 | l = l[:limit] | |
199 |
|
199 | |||
200 | for e in l: |
|
200 | for e in l: | |
201 | yield e |
|
201 | yield e | |
202 |
|
202 | |||
203 | maxchanges = shortlog and web.maxshortchanges or web.maxchanges |
|
203 | maxchanges = shortlog and web.maxshortchanges or web.maxchanges | |
204 | cl = web.repo.changelog |
|
204 | cl = web.repo.changelog | |
205 | count = len(cl) |
|
205 | count = len(cl) | |
206 | pos = ctx.rev() |
|
206 | pos = ctx.rev() | |
207 | start = max(0, pos - maxchanges + 1) |
|
207 | start = max(0, pos - maxchanges + 1) | |
208 | end = min(count, start + maxchanges) |
|
208 | end = min(count, start + maxchanges) | |
209 | pos = end - 1 |
|
209 | pos = end - 1 | |
210 | parity = paritygen(web.stripecount, offset=start-end) |
|
210 | parity = paritygen(web.stripecount, offset=start-end) | |
211 |
|
211 | |||
212 | changenav = webutil.revnavgen(pos, maxchanges, count, web.repo.changectx) |
|
212 | changenav = webutil.revnavgen(pos, maxchanges, count, web.repo.changectx) | |
213 |
|
213 | |||
214 | return tmpl(shortlog and 'shortlog' or 'changelog', |
|
214 | return tmpl(shortlog and 'shortlog' or 'changelog', | |
215 | changenav=changenav, |
|
215 | changenav=changenav, | |
216 | node=hex(ctx.node()), |
|
216 | node=hex(ctx.node()), | |
217 | rev=pos, changesets=count, |
|
217 | rev=pos, changesets=count, | |
218 | entries=lambda **x: changelist(limit=0,**x), |
|
218 | entries=lambda **x: changelist(limit=0,**x), | |
219 | latestentry=lambda **x: changelist(limit=1,**x), |
|
219 | latestentry=lambda **x: changelist(limit=1,**x), | |
220 | archives=web.archivelist("tip")) |
|
220 | archives=web.archivelist("tip")) | |
221 |
|
221 | |||
222 | def shortlog(web, req, tmpl): |
|
222 | def shortlog(web, req, tmpl): | |
223 | return changelog(web, req, tmpl, shortlog = True) |
|
223 | return changelog(web, req, tmpl, shortlog = True) | |
224 |
|
224 | |||
225 | def changeset(web, req, tmpl): |
|
225 | def changeset(web, req, tmpl): | |
226 | ctx = webutil.changectx(web.repo, req) |
|
226 | ctx = webutil.changectx(web.repo, req) | |
227 | showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node()) |
|
227 | showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node()) | |
228 | showbranch = webutil.nodebranchnodefault(ctx) |
|
228 | showbranch = webutil.nodebranchnodefault(ctx) | |
229 |
|
229 | |||
230 | files = [] |
|
230 | files = [] | |
231 | parity = paritygen(web.stripecount) |
|
231 | parity = paritygen(web.stripecount) | |
232 | for f in ctx.files(): |
|
232 | for f in ctx.files(): | |
233 | template = f in ctx and 'filenodelink' or 'filenolink' |
|
233 | template = f in ctx and 'filenodelink' or 'filenolink' | |
234 | files.append(tmpl(template, |
|
234 | files.append(tmpl(template, | |
235 | node=ctx.hex(), file=f, |
|
235 | node=ctx.hex(), file=f, | |
236 | parity=parity.next())) |
|
236 | parity=parity.next())) | |
237 |
|
237 | |||
238 | parity = paritygen(web.stripecount) |
|
238 | parity = paritygen(web.stripecount) | |
239 | diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity) |
|
239 | diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity) | |
240 | return tmpl('changeset', |
|
240 | return tmpl('changeset', | |
241 | diff=diffs, |
|
241 | diff=diffs, | |
242 | rev=ctx.rev(), |
|
242 | rev=ctx.rev(), | |
243 | node=ctx.hex(), |
|
243 | node=ctx.hex(), | |
244 | parent=webutil.parents(ctx), |
|
244 | parent=webutil.parents(ctx), | |
245 | child=webutil.children(ctx), |
|
245 | child=webutil.children(ctx), | |
246 | changesettag=showtags, |
|
246 | changesettag=showtags, | |
247 | changesetbranch=showbranch, |
|
247 | changesetbranch=showbranch, | |
248 | author=ctx.user(), |
|
248 | author=ctx.user(), | |
249 | desc=ctx.description(), |
|
249 | desc=ctx.description(), | |
250 | date=ctx.date(), |
|
250 | date=ctx.date(), | |
251 | files=files, |
|
251 | files=files, | |
252 | archives=web.archivelist(ctx.hex()), |
|
252 | archives=web.archivelist(ctx.hex()), | |
253 | tags=webutil.nodetagsdict(web.repo, ctx.node()), |
|
253 | tags=webutil.nodetagsdict(web.repo, ctx.node()), | |
254 | branch=webutil.nodebranchnodefault(ctx), |
|
254 | branch=webutil.nodebranchnodefault(ctx), | |
255 | inbranch=webutil.nodeinbranch(web.repo, ctx), |
|
255 | inbranch=webutil.nodeinbranch(web.repo, ctx), | |
256 | branches=webutil.nodebranchdict(web.repo, ctx)) |
|
256 | branches=webutil.nodebranchdict(web.repo, ctx)) | |
257 |
|
257 | |||
258 | rev = changeset |
|
258 | rev = changeset | |
259 |
|
259 | |||
260 | def manifest(web, req, tmpl): |
|
260 | def manifest(web, req, tmpl): | |
261 | ctx = webutil.changectx(web.repo, req) |
|
261 | ctx = webutil.changectx(web.repo, req) | |
262 | path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) |
|
262 | path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) | |
263 | mf = ctx.manifest() |
|
263 | mf = ctx.manifest() | |
264 | node = ctx.node() |
|
264 | node = ctx.node() | |
265 |
|
265 | |||
266 | files = {} |
|
266 | files = {} | |
267 | dirs = {} |
|
267 | dirs = {} | |
268 | parity = paritygen(web.stripecount) |
|
268 | parity = paritygen(web.stripecount) | |
269 |
|
269 | |||
270 | if path and path[-1] != "/": |
|
270 | if path and path[-1] != "/": | |
271 | path += "/" |
|
271 | path += "/" | |
272 | l = len(path) |
|
272 | l = len(path) | |
273 | abspath = "/" + path |
|
273 | abspath = "/" + path | |
274 |
|
274 | |||
275 | for f, n in mf.iteritems(): |
|
275 | for f, n in mf.iteritems(): | |
276 | if f[:l] != path: |
|
276 | if f[:l] != path: | |
277 | continue |
|
277 | continue | |
278 | remain = f[l:] |
|
278 | remain = f[l:] | |
279 | elements = remain.split('/') |
|
279 | elements = remain.split('/') | |
280 | if len(elements) == 1: |
|
280 | if len(elements) == 1: | |
281 | files[remain] = f |
|
281 | files[remain] = f | |
282 | else: |
|
282 | else: | |
283 | h = dirs # need to retain ref to dirs (root) |
|
283 | h = dirs # need to retain ref to dirs (root) | |
284 | for elem in elements[0:-1]: |
|
284 | for elem in elements[0:-1]: | |
285 | if elem not in h: |
|
285 | if elem not in h: | |
286 | h[elem] = {} |
|
286 | h[elem] = {} | |
287 | h = h[elem] |
|
287 | h = h[elem] | |
288 | if len(h) > 1: |
|
288 | if len(h) > 1: | |
289 | break |
|
289 | break | |
290 | h[None] = None # denotes files present |
|
290 | h[None] = None # denotes files present | |
291 |
|
291 | |||
292 | if mf and not files and not dirs: |
|
292 | if mf and not files and not dirs: | |
293 | raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path) |
|
293 | raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path) | |
294 |
|
294 | |||
295 | def filelist(**map): |
|
295 | def filelist(**map): | |
296 | for f in sorted(files): |
|
296 | for f in sorted(files): | |
297 | full = files[f] |
|
297 | full = files[f] | |
298 |
|
298 | |||
299 | fctx = ctx.filectx(full) |
|
299 | fctx = ctx.filectx(full) | |
300 | yield {"file": full, |
|
300 | yield {"file": full, | |
301 | "parity": parity.next(), |
|
301 | "parity": parity.next(), | |
302 | "basename": f, |
|
302 | "basename": f, | |
303 | "date": fctx.date(), |
|
303 | "date": fctx.date(), | |
304 | "size": fctx.size(), |
|
304 | "size": fctx.size(), | |
305 | "permissions": mf.flags(full)} |
|
305 | "permissions": mf.flags(full)} | |
306 |
|
306 | |||
307 | def dirlist(**map): |
|
307 | def dirlist(**map): | |
308 | for d in sorted(dirs): |
|
308 | for d in sorted(dirs): | |
309 |
|
309 | |||
310 | emptydirs = [] |
|
310 | emptydirs = [] | |
311 | h = dirs[d] |
|
311 | h = dirs[d] | |
312 | while isinstance(h, dict) and len(h) == 1: |
|
312 | while isinstance(h, dict) and len(h) == 1: | |
313 | k,v = h.items()[0] |
|
313 | k,v = h.items()[0] | |
314 | if v: |
|
314 | if v: | |
315 | emptydirs.append(k) |
|
315 | emptydirs.append(k) | |
316 | h = v |
|
316 | h = v | |
317 |
|
317 | |||
318 | path = "%s%s" % (abspath, d) |
|
318 | path = "%s%s" % (abspath, d) | |
319 | yield {"parity": parity.next(), |
|
319 | yield {"parity": parity.next(), | |
320 | "path": path, |
|
320 | "path": path, | |
321 | "emptydirs": "/".join(emptydirs), |
|
321 | "emptydirs": "/".join(emptydirs), | |
322 | "basename": d} |
|
322 | "basename": d} | |
323 |
|
323 | |||
324 | return tmpl("manifest", |
|
324 | return tmpl("manifest", | |
325 | rev=ctx.rev(), |
|
325 | rev=ctx.rev(), | |
326 | node=hex(node), |
|
326 | node=hex(node), | |
327 | path=abspath, |
|
327 | path=abspath, | |
328 | up=webutil.up(abspath), |
|
328 | up=webutil.up(abspath), | |
329 | upparity=parity.next(), |
|
329 | upparity=parity.next(), | |
330 | fentries=filelist, |
|
330 | fentries=filelist, | |
331 | dentries=dirlist, |
|
331 | dentries=dirlist, | |
332 | archives=web.archivelist(hex(node)), |
|
332 | archives=web.archivelist(hex(node)), | |
333 | tags=webutil.nodetagsdict(web.repo, node), |
|
333 | tags=webutil.nodetagsdict(web.repo, node), | |
334 | inbranch=webutil.nodeinbranch(web.repo, ctx), |
|
334 | inbranch=webutil.nodeinbranch(web.repo, ctx), | |
335 | branches=webutil.nodebranchdict(web.repo, ctx)) |
|
335 | branches=webutil.nodebranchdict(web.repo, ctx)) | |
336 |
|
336 | |||
337 | def tags(web, req, tmpl): |
|
337 | def tags(web, req, tmpl): | |
338 | i = web.repo.tagslist() |
|
338 | i = web.repo.tagslist() | |
339 | i.reverse() |
|
339 | i.reverse() | |
340 | parity = paritygen(web.stripecount) |
|
340 | parity = paritygen(web.stripecount) | |
341 |
|
341 | |||
342 | def entries(notip=False,limit=0, **map): |
|
342 | def entries(notip=False,limit=0, **map): | |
343 | count = 0 |
|
343 | count = 0 | |
344 | for k, n in i: |
|
344 | for k, n in i: | |
345 | if notip and k == "tip": |
|
345 | if notip and k == "tip": | |
346 | continue |
|
346 | continue | |
347 | if limit > 0 and count >= limit: |
|
347 | if limit > 0 and count >= limit: | |
348 | continue |
|
348 | continue | |
349 | count = count + 1 |
|
349 | count = count + 1 | |
350 | yield {"parity": parity.next(), |
|
350 | yield {"parity": parity.next(), | |
351 | "tag": k, |
|
351 | "tag": k, | |
352 | "date": web.repo[n].date(), |
|
352 | "date": web.repo[n].date(), | |
353 | "node": hex(n)} |
|
353 | "node": hex(n)} | |
354 |
|
354 | |||
355 | return tmpl("tags", |
|
355 | return tmpl("tags", | |
356 | node=hex(web.repo.changelog.tip()), |
|
356 | node=hex(web.repo.changelog.tip()), | |
357 | entries=lambda **x: entries(False,0, **x), |
|
357 | entries=lambda **x: entries(False,0, **x), | |
358 | entriesnotip=lambda **x: entries(True,0, **x), |
|
358 | entriesnotip=lambda **x: entries(True,0, **x), | |
359 | latestentry=lambda **x: entries(True,1, **x)) |
|
359 | latestentry=lambda **x: entries(True,1, **x)) | |
360 |
|
360 | |||
361 | def summary(web, req, tmpl): |
|
361 | def summary(web, req, tmpl): | |
362 | i = web.repo.tagslist() |
|
362 | i = web.repo.tagslist() | |
363 | i.reverse() |
|
363 | i.reverse() | |
364 |
|
364 | |||
365 | def tagentries(**map): |
|
365 | def tagentries(**map): | |
366 | parity = paritygen(web.stripecount) |
|
366 | parity = paritygen(web.stripecount) | |
367 | count = 0 |
|
367 | count = 0 | |
368 | for k, n in i: |
|
368 | for k, n in i: | |
369 | if k == "tip": # skip tip |
|
369 | if k == "tip": # skip tip | |
370 | continue |
|
370 | continue | |
371 |
|
371 | |||
372 | count += 1 |
|
372 | count += 1 | |
373 | if count > 10: # limit to 10 tags |
|
373 | if count > 10: # limit to 10 tags | |
374 | break |
|
374 | break | |
375 |
|
375 | |||
376 | yield tmpl("tagentry", |
|
376 | yield tmpl("tagentry", | |
377 | parity=parity.next(), |
|
377 | parity=parity.next(), | |
378 | tag=k, |
|
378 | tag=k, | |
379 | node=hex(n), |
|
379 | node=hex(n), | |
380 | date=web.repo[n].date()) |
|
380 | date=web.repo[n].date()) | |
381 |
|
381 | |||
382 | def branches(**map): |
|
382 | def branches(**map): | |
383 | parity = paritygen(web.stripecount) |
|
383 | parity = paritygen(web.stripecount) | |
384 |
|
384 | |||
385 | b = web.repo.branchtags() |
|
385 | b = web.repo.branchtags() | |
386 | l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()] |
|
386 | l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()] | |
387 | for r,n,t in sorted(l): |
|
387 | for r,n,t in sorted(l): | |
388 | yield {'parity': parity.next(), |
|
388 | yield {'parity': parity.next(), | |
389 | 'branch': t, |
|
389 | 'branch': t, | |
390 | 'node': hex(n), |
|
390 | 'node': hex(n), | |
391 | 'date': web.repo[n].date()} |
|
391 | 'date': web.repo[n].date()} | |
392 |
|
392 | |||
393 | def changelist(**map): |
|
393 | def changelist(**map): | |
394 | parity = paritygen(web.stripecount, offset=start-end) |
|
394 | parity = paritygen(web.stripecount, offset=start-end) | |
395 | l = [] # build a list in forward order for efficiency |
|
395 | l = [] # build a list in forward order for efficiency | |
396 | for i in xrange(start, end): |
|
396 | for i in xrange(start, end): | |
397 | ctx = web.repo[i] |
|
397 | ctx = web.repo[i] | |
398 | n = ctx.node() |
|
398 | n = ctx.node() | |
399 | hn = hex(n) |
|
399 | hn = hex(n) | |
400 |
|
400 | |||
401 | l.insert(0, tmpl( |
|
401 | l.insert(0, tmpl( | |
402 | 'shortlogentry', |
|
402 | 'shortlogentry', | |
403 | parity=parity.next(), |
|
403 | parity=parity.next(), | |
404 | author=ctx.user(), |
|
404 | author=ctx.user(), | |
405 | desc=ctx.description(), |
|
405 | desc=ctx.description(), | |
406 | date=ctx.date(), |
|
406 | date=ctx.date(), | |
407 | rev=i, |
|
407 | rev=i, | |
408 | node=hn, |
|
408 | node=hn, | |
409 | tags=webutil.nodetagsdict(web.repo, n), |
|
409 | tags=webutil.nodetagsdict(web.repo, n), | |
410 | inbranch=webutil.nodeinbranch(web.repo, ctx), |
|
410 | inbranch=webutil.nodeinbranch(web.repo, ctx), | |
411 | branches=webutil.nodebranchdict(web.repo, ctx))) |
|
411 | branches=webutil.nodebranchdict(web.repo, ctx))) | |
412 |
|
412 | |||
413 | yield l |
|
413 | yield l | |
414 |
|
414 | |||
415 | cl = web.repo.changelog |
|
415 | cl = web.repo.changelog | |
416 | count = len(cl) |
|
416 | count = len(cl) | |
417 | start = max(0, count - web.maxchanges) |
|
417 | start = max(0, count - web.maxchanges) | |
418 | end = min(count, start + web.maxchanges) |
|
418 | end = min(count, start + web.maxchanges) | |
419 |
|
419 | |||
420 | return tmpl("summary", |
|
420 | return tmpl("summary", | |
421 | desc=web.config("web", "description", "unknown"), |
|
421 | desc=web.config("web", "description", "unknown"), | |
422 | owner=get_contact(web.config) or "unknown", |
|
422 | owner=get_contact(web.config) or "unknown", | |
423 | lastchange=cl.read(cl.tip())[2], |
|
423 | lastchange=cl.read(cl.tip())[2], | |
424 | tags=tagentries, |
|
424 | tags=tagentries, | |
425 | branches=branches, |
|
425 | branches=branches, | |
426 | shortlog=changelist, |
|
426 | shortlog=changelist, | |
427 | node=hex(cl.tip()), |
|
427 | node=hex(cl.tip()), | |
428 | archives=web.archivelist("tip")) |
|
428 | archives=web.archivelist("tip")) | |
429 |
|
429 | |||
430 | def filediff(web, req, tmpl): |
|
430 | def filediff(web, req, tmpl): | |
431 | fctx, ctx = None, None |
|
431 | fctx, ctx = None, None | |
432 | try: |
|
432 | try: | |
433 | fctx = webutil.filectx(web.repo, req) |
|
433 | fctx = webutil.filectx(web.repo, req) | |
434 | except LookupError: |
|
434 | except LookupError: | |
435 | ctx = webutil.changectx(web.repo, req) |
|
435 | ctx = webutil.changectx(web.repo, req) | |
436 | path = webutil.cleanpath(web.repo, req.form['file'][0]) |
|
436 | path = webutil.cleanpath(web.repo, req.form['file'][0]) | |
437 | if path not in ctx.files(): |
|
437 | if path not in ctx.files(): | |
438 | raise |
|
438 | raise | |
439 |
|
439 | |||
440 | if fctx is not None: |
|
440 | if fctx is not None: | |
441 | n = fctx.node() |
|
441 | n = fctx.node() | |
442 | path = fctx.path() |
|
442 | path = fctx.path() | |
443 | else: |
|
443 | else: | |
444 | n = ctx.node() |
|
444 | n = ctx.node() | |
445 | # path already defined in except clause |
|
445 | # path already defined in except clause | |
446 |
|
446 | |||
447 | parity = paritygen(web.stripecount) |
|
447 | parity = paritygen(web.stripecount) | |
448 | diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity) |
|
448 | diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity) | |
449 | rename = fctx and webutil.renamelink(fctx) or [] |
|
449 | rename = fctx and webutil.renamelink(fctx) or [] | |
450 | ctx = fctx and fctx or ctx |
|
450 | ctx = fctx and fctx or ctx | |
451 | return tmpl("filediff", |
|
451 | return tmpl("filediff", | |
452 | file=path, |
|
452 | file=path, | |
453 | node=hex(n), |
|
453 | node=hex(n), | |
454 | rev=ctx.rev(), |
|
454 | rev=ctx.rev(), | |
455 | date=ctx.date(), |
|
455 | date=ctx.date(), | |
456 | desc=ctx.description(), |
|
456 | desc=ctx.description(), | |
457 | author=ctx.user(), |
|
457 | author=ctx.user(), | |
458 | rename=rename, |
|
458 | rename=rename, | |
459 | branch=webutil.nodebranchnodefault(ctx), |
|
459 | branch=webutil.nodebranchnodefault(ctx), | |
460 | parent=webutil.parents(ctx), |
|
460 | parent=webutil.parents(ctx), | |
461 | child=webutil.children(ctx), |
|
461 | child=webutil.children(ctx), | |
462 | diff=diffs) |
|
462 | diff=diffs) | |
463 |
|
463 | |||
464 | diff = filediff |
|
464 | diff = filediff | |
465 |
|
465 | |||
466 | def annotate(web, req, tmpl): |
|
466 | def annotate(web, req, tmpl): | |
467 | fctx = webutil.filectx(web.repo, req) |
|
467 | fctx = webutil.filectx(web.repo, req) | |
468 | f = fctx.path() |
|
468 | f = fctx.path() | |
469 | parity = paritygen(web.stripecount) |
|
469 | parity = paritygen(web.stripecount) | |
470 |
|
470 | |||
471 | def annotate(**map): |
|
471 | def annotate(**map): | |
472 | last = None |
|
472 | last = None | |
473 | if binary(fctx.data()): |
|
473 | if binary(fctx.data()): | |
474 | mt = (mimetypes.guess_type(fctx.path())[0] |
|
474 | mt = (mimetypes.guess_type(fctx.path())[0] | |
475 | or 'application/octet-stream') |
|
475 | or 'application/octet-stream') | |
476 | lines = enumerate([((fctx.filectx(fctx.filerev()), 1), |
|
476 | lines = enumerate([((fctx.filectx(fctx.filerev()), 1), | |
477 | '(binary:%s)' % mt)]) |
|
477 | '(binary:%s)' % mt)]) | |
478 | else: |
|
478 | else: | |
479 | lines = enumerate(fctx.annotate(follow=True, linenumber=True)) |
|
479 | lines = enumerate(fctx.annotate(follow=True, linenumber=True)) | |
480 | for lineno, ((f, targetline), l) in lines: |
|
480 | for lineno, ((f, targetline), l) in lines: | |
481 | fnode = f.filenode() |
|
481 | fnode = f.filenode() | |
482 |
|
482 | |||
483 | if last != fnode: |
|
483 | if last != fnode: | |
484 | last = fnode |
|
484 | last = fnode | |
485 |
|
485 | |||
486 | yield {"parity": parity.next(), |
|
486 | yield {"parity": parity.next(), | |
487 | "node": hex(f.node()), |
|
487 | "node": hex(f.node()), | |
488 | "rev": f.rev(), |
|
488 | "rev": f.rev(), | |
489 | "author": f.user(), |
|
489 | "author": f.user(), | |
490 | "desc": f.description(), |
|
490 | "desc": f.description(), | |
491 | "file": f.path(), |
|
491 | "file": f.path(), | |
492 | "targetline": targetline, |
|
492 | "targetline": targetline, | |
493 | "line": l, |
|
493 | "line": l, | |
494 | "lineid": "l%d" % (lineno + 1), |
|
494 | "lineid": "l%d" % (lineno + 1), | |
495 | "linenumber": "% 6d" % (lineno + 1)} |
|
495 | "linenumber": "% 6d" % (lineno + 1)} | |
496 |
|
496 | |||
497 | return tmpl("fileannotate", |
|
497 | return tmpl("fileannotate", | |
498 | file=f, |
|
498 | file=f, | |
499 | annotate=annotate, |
|
499 | annotate=annotate, | |
500 | path=webutil.up(f), |
|
500 | path=webutil.up(f), | |
501 | rev=fctx.rev(), |
|
501 | rev=fctx.rev(), | |
502 | node=hex(fctx.node()), |
|
502 | node=hex(fctx.node()), | |
503 | author=fctx.user(), |
|
503 | author=fctx.user(), | |
504 | date=fctx.date(), |
|
504 | date=fctx.date(), | |
505 | desc=fctx.description(), |
|
505 | desc=fctx.description(), | |
506 | rename=webutil.renamelink(fctx), |
|
506 | rename=webutil.renamelink(fctx), | |
507 | branch=webutil.nodebranchnodefault(fctx), |
|
507 | branch=webutil.nodebranchnodefault(fctx), | |
508 | parent=webutil.parents(fctx), |
|
508 | parent=webutil.parents(fctx), | |
509 | child=webutil.children(fctx), |
|
509 | child=webutil.children(fctx), | |
510 | permissions=fctx.manifest().flags(f)) |
|
510 | permissions=fctx.manifest().flags(f)) | |
511 |
|
511 | |||
512 | def filelog(web, req, tmpl): |
|
512 | def filelog(web, req, tmpl): | |
513 |
|
513 | |||
514 | try: |
|
514 | try: | |
515 | fctx = webutil.filectx(web.repo, req) |
|
515 | fctx = webutil.filectx(web.repo, req) | |
516 | f = fctx.path() |
|
516 | f = fctx.path() | |
517 | fl = fctx.filelog() |
|
517 | fl = fctx.filelog() | |
518 | except error.LookupError: |
|
518 | except error.LookupError: | |
519 | f = webutil.cleanpath(web.repo, req.form['file'][0]) |
|
519 | f = webutil.cleanpath(web.repo, req.form['file'][0]) | |
520 | fl = web.repo.file(f) |
|
520 | fl = web.repo.file(f) | |
521 | numrevs = len(fl) |
|
521 | numrevs = len(fl) | |
522 | if not numrevs: # file doesn't exist at all |
|
522 | if not numrevs: # file doesn't exist at all | |
523 | raise |
|
523 | raise | |
524 | rev = webutil.changectx(web.repo, req).rev() |
|
524 | rev = webutil.changectx(web.repo, req).rev() | |
525 | first = fl.linkrev(0) |
|
525 | first = fl.linkrev(0) | |
526 | if rev < first: # current rev is from before file existed |
|
526 | if rev < first: # current rev is from before file existed | |
527 | raise |
|
527 | raise | |
528 | frev = numrevs - 1 |
|
528 | frev = numrevs - 1 | |
529 | while fl.linkrev(frev) > rev: |
|
529 | while fl.linkrev(frev) > rev: | |
530 | frev -= 1 |
|
530 | frev -= 1 | |
531 | fctx = web.repo.filectx(f, fl.linkrev(frev)) |
|
531 | fctx = web.repo.filectx(f, fl.linkrev(frev)) | |
532 |
|
532 | |||
533 | count = fctx.filerev() + 1 |
|
533 | count = fctx.filerev() + 1 | |
534 | pagelen = web.maxshortchanges |
|
534 | pagelen = web.maxshortchanges | |
535 | start = max(0, fctx.filerev() - pagelen + 1) # first rev on this page |
|
535 | start = max(0, fctx.filerev() - pagelen + 1) # first rev on this page | |
536 | end = min(count, start + pagelen) # last rev on this page |
|
536 | end = min(count, start + pagelen) # last rev on this page | |
537 | parity = paritygen(web.stripecount, offset=start-end) |
|
537 | parity = paritygen(web.stripecount, offset=start-end) | |
538 |
|
538 | |||
539 | def entries(limit=0, **map): |
|
539 | def entries(limit=0, **map): | |
540 | l = [] |
|
540 | l = [] | |
541 |
|
541 | |||
542 | repo = web.repo |
|
542 | repo = web.repo | |
543 | for i in xrange(start, end): |
|
543 | for i in xrange(start, end): | |
544 | iterfctx = fctx.filectx(i) |
|
544 | iterfctx = fctx.filectx(i) | |
545 |
|
545 | |||
546 | l.insert(0, {"parity": parity.next(), |
|
546 | l.insert(0, {"parity": parity.next(), | |
547 | "filerev": i, |
|
547 | "filerev": i, | |
548 | "file": f, |
|
548 | "file": f, | |
549 | "node": hex(iterfctx.node()), |
|
549 | "node": hex(iterfctx.node()), | |
550 | "author": iterfctx.user(), |
|
550 | "author": iterfctx.user(), | |
551 | "date": iterfctx.date(), |
|
551 | "date": iterfctx.date(), | |
552 | "rename": webutil.renamelink(iterfctx), |
|
552 | "rename": webutil.renamelink(iterfctx), | |
553 | "parent": webutil.parents(iterfctx), |
|
553 | "parent": webutil.parents(iterfctx), | |
554 | "child": webutil.children(iterfctx), |
|
554 | "child": webutil.children(iterfctx), | |
555 | "desc": iterfctx.description(), |
|
555 | "desc": iterfctx.description(), | |
556 | "tags": webutil.nodetagsdict(repo, iterfctx.node()), |
|
556 | "tags": webutil.nodetagsdict(repo, iterfctx.node()), | |
557 | "branch": webutil.nodebranchnodefault(iterfctx), |
|
557 | "branch": webutil.nodebranchnodefault(iterfctx), | |
558 | "inbranch": webutil.nodeinbranch(repo, iterfctx), |
|
558 | "inbranch": webutil.nodeinbranch(repo, iterfctx), | |
559 | "branches": webutil.nodebranchdict(repo, iterfctx)}) |
|
559 | "branches": webutil.nodebranchdict(repo, iterfctx)}) | |
560 |
|
560 | |||
561 | if limit > 0: |
|
561 | if limit > 0: | |
562 | l = l[:limit] |
|
562 | l = l[:limit] | |
563 |
|
563 | |||
564 | for e in l: |
|
564 | for e in l: | |
565 | yield e |
|
565 | yield e | |
566 |
|
566 | |||
567 | nodefunc = lambda x: fctx.filectx(fileid=x) |
|
567 | nodefunc = lambda x: fctx.filectx(fileid=x) | |
568 | nav = webutil.revnavgen(end - 1, pagelen, count, nodefunc) |
|
568 | nav = webutil.revnavgen(end - 1, pagelen, count, nodefunc) | |
569 | return tmpl("filelog", file=f, node=hex(fctx.node()), nav=nav, |
|
569 | return tmpl("filelog", file=f, node=hex(fctx.node()), nav=nav, | |
570 | entries=lambda **x: entries(limit=0, **x), |
|
570 | entries=lambda **x: entries(limit=0, **x), | |
571 | latestentry=lambda **x: entries(limit=1, **x)) |
|
571 | latestentry=lambda **x: entries(limit=1, **x)) | |
572 |
|
572 | |||
573 |
|
573 | |||
574 | def archive(web, req, tmpl): |
|
574 | def archive(web, req, tmpl): | |
575 | type_ = req.form.get('type', [None])[0] |
|
575 | type_ = req.form.get('type', [None])[0] | |
576 | allowed = web.configlist("web", "allow_archive") |
|
576 | allowed = web.configlist("web", "allow_archive") | |
577 | key = req.form['node'][0] |
|
577 | key = req.form['node'][0] | |
578 |
|
578 | |||
579 | if type_ not in web.archives: |
|
579 | if type_ not in web.archives: | |
580 | msg = 'Unsupported archive type: %s' % type_ |
|
580 | msg = 'Unsupported archive type: %s' % type_ | |
581 | raise ErrorResponse(HTTP_NOT_FOUND, msg) |
|
581 | raise ErrorResponse(HTTP_NOT_FOUND, msg) | |
582 |
|
582 | |||
583 | if not ((type_ in allowed or |
|
583 | if not ((type_ in allowed or | |
584 | web.configbool("web", "allow" + type_, False))): |
|
584 | web.configbool("web", "allow" + type_, False))): | |
585 | msg = 'Archive type not allowed: %s' % type_ |
|
585 | msg = 'Archive type not allowed: %s' % type_ | |
586 | raise ErrorResponse(HTTP_FORBIDDEN, msg) |
|
586 | raise ErrorResponse(HTTP_FORBIDDEN, msg) | |
587 |
|
587 | |||
588 | reponame = re.sub(r"\W+", "-", os.path.basename(web.reponame)) |
|
588 | reponame = re.sub(r"\W+", "-", os.path.basename(web.reponame)) | |
589 | cnode = web.repo.lookup(key) |
|
589 | cnode = web.repo.lookup(key) | |
590 | arch_version = key |
|
590 | arch_version = key | |
591 | if cnode == key or key == 'tip': |
|
591 | if cnode == key or key == 'tip': | |
592 | arch_version = short(cnode) |
|
592 | arch_version = short(cnode) | |
593 | name = "%s-%s" % (reponame, arch_version) |
|
593 | name = "%s-%s" % (reponame, arch_version) | |
594 | mimetype, artype, extension, encoding = web.archive_specs[type_] |
|
594 | mimetype, artype, extension, encoding = web.archive_specs[type_] | |
595 | headers = [ |
|
595 | headers = [ | |
596 | ('Content-Type', mimetype), |
|
596 | ('Content-Type', mimetype), | |
597 | ('Content-Disposition', 'attachment; filename=%s%s' % (name, extension)) |
|
597 | ('Content-Disposition', 'attachment; filename=%s%s' % (name, extension)) | |
598 | ] |
|
598 | ] | |
599 | if encoding: |
|
599 | if encoding: | |
600 | headers.append(('Content-Encoding', encoding)) |
|
600 | headers.append(('Content-Encoding', encoding)) | |
601 | req.header(headers) |
|
601 | req.header(headers) | |
602 | req.respond(HTTP_OK) |
|
602 | req.respond(HTTP_OK) | |
603 | archival.archive(web.repo, req, cnode, artype, prefix=name) |
|
603 | archival.archive(web.repo, req, cnode, artype, prefix=name) | |
604 | return [] |
|
604 | return [] | |
605 |
|
605 | |||
606 |
|
606 | |||
607 | def static(web, req, tmpl): |
|
607 | def static(web, req, tmpl): | |
608 | fname = req.form['file'][0] |
|
608 | fname = req.form['file'][0] | |
609 | # a repo owner may set web.static in .hg/hgrc to get any file |
|
609 | # a repo owner may set web.static in .hg/hgrc to get any file | |
610 | # readable by the user running the CGI script |
|
610 | # readable by the user running the CGI script | |
611 | static = web.config("web", "static", None, untrusted=False) |
|
611 | static = web.config("web", "static", None, untrusted=False) | |
612 | if not static: |
|
612 | if not static: | |
613 | tp = web.templatepath or templater.templatepath() |
|
613 | tp = web.templatepath or templater.templatepath() | |
614 | if isinstance(tp, str): |
|
614 | if isinstance(tp, str): | |
615 | tp = [tp] |
|
615 | tp = [tp] | |
616 | static = [os.path.join(p, 'static') for p in tp] |
|
616 | static = [os.path.join(p, 'static') for p in tp] | |
617 | return [staticfile(static, fname, req)] |
|
617 | return [staticfile(static, fname, req)] | |
618 |
|
618 | |||
619 | def graph(web, req, tmpl): |
|
619 | def graph(web, req, tmpl): | |
620 | rev = webutil.changectx(web.repo, req).rev() |
|
620 | rev = webutil.changectx(web.repo, req).rev() | |
621 | bg_height = 39 |
|
621 | bg_height = 39 | |
622 |
|
622 | |||
623 | revcount = 25 |
|
623 | revcount = 25 | |
624 | if 'revcount' in req.form: |
|
624 | if 'revcount' in req.form: | |
625 | revcount = int(req.form.get('revcount', [revcount])[0]) |
|
625 | revcount = int(req.form.get('revcount', [revcount])[0]) | |
626 | tmpl.defaults['sessionvars']['revcount'] = revcount |
|
626 | tmpl.defaults['sessionvars']['revcount'] = revcount | |
627 |
|
627 | |||
628 | lessvars = copy.copy(tmpl.defaults['sessionvars']) |
|
628 | lessvars = copy.copy(tmpl.defaults['sessionvars']) | |
629 | lessvars['revcount'] = revcount / 2 |
|
629 | lessvars['revcount'] = revcount / 2 | |
630 | morevars = copy.copy(tmpl.defaults['sessionvars']) |
|
630 | morevars = copy.copy(tmpl.defaults['sessionvars']) | |
631 | morevars['revcount'] = revcount * 2 |
|
631 | morevars['revcount'] = revcount * 2 | |
632 |
|
632 | |||
633 | max_rev = len(web.repo) - 1 |
|
633 | max_rev = len(web.repo) - 1 | |
634 | revcount = min(max_rev, revcount) |
|
634 | revcount = min(max_rev, revcount) | |
635 | revnode = web.repo.changelog.node(rev) |
|
635 | revnode = web.repo.changelog.node(rev) | |
636 | revnode_hex = hex(revnode) |
|
636 | revnode_hex = hex(revnode) | |
637 | uprev = min(max_rev, rev + revcount) |
|
637 | uprev = min(max_rev, rev + revcount) | |
638 | downrev = max(0, rev - revcount) |
|
638 | downrev = max(0, rev - revcount) | |
639 | count = len(web.repo) |
|
639 | count = len(web.repo) | |
640 | changenav = webutil.revnavgen(rev, revcount, count, web.repo.changectx) |
|
640 | changenav = webutil.revnavgen(rev, revcount, count, web.repo.changectx) | |
641 |
|
641 | |||
642 | tree = list(graphmod.graph(web.repo, rev, downrev)) |
|
642 | tree = list(graphmod.graph(web.repo, rev, downrev)) | |
643 | canvasheight = (len(tree) + 1) * bg_height - 27; |
|
643 | canvasheight = (len(tree) + 1) * bg_height - 27; | |
644 | data = [] |
|
644 | data = [] | |
645 | for (ctx, vtx, edges) in tree: |
|
645 | for (ctx, vtx, edges) in tree: | |
646 | node = short(ctx.node()) |
|
646 | node = short(ctx.node()) | |
647 | age = templatefilters.age(ctx.date()) |
|
647 | age = templatefilters.age(ctx.date()) | |
648 | desc = templatefilters.firstline(ctx.description()) |
|
648 | desc = templatefilters.firstline(ctx.description()) | |
649 | desc = cgi.escape(desc) |
|
649 | desc = cgi.escape(templatefilters.nonempty(desc)) | |
650 | user = cgi.escape(templatefilters.person(ctx.user())) |
|
650 | user = cgi.escape(templatefilters.person(ctx.user())) | |
651 | branch = ctx.branch() |
|
651 | branch = ctx.branch() | |
652 | branch = branch, web.repo.branchtags().get(branch) == ctx.node() |
|
652 | branch = branch, web.repo.branchtags().get(branch) == ctx.node() | |
653 | data.append((node, vtx, edges, desc, user, age, branch, ctx.tags())) |
|
653 | data.append((node, vtx, edges, desc, user, age, branch, ctx.tags())) | |
654 |
|
654 | |||
655 | return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev, |
|
655 | return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev, | |
656 | lessvars=lessvars, morevars=morevars, downrev=downrev, |
|
656 | lessvars=lessvars, morevars=morevars, downrev=downrev, | |
657 | canvasheight=canvasheight, jsdata=data, bg_height=bg_height, |
|
657 | canvasheight=canvasheight, jsdata=data, bg_height=bg_height, | |
658 | node=revnode_hex, changenav=changenav) |
|
658 | node=revnode_hex, changenav=changenav) |
@@ -1,123 +1,120 b'' | |||||
1 | #header# |
|
1 | #header# | |
2 | <title>#repo|escape#: Graph</title> |
|
2 | <title>#repo|escape#: Graph</title> | |
3 | <link rel="alternate" type="application/atom+xml" |
|
3 | <link rel="alternate" type="application/atom+xml" | |
4 | href="{url}atom-log" title="Atom feed for #repo|escape#"/> |
|
4 | href="{url}atom-log" title="Atom feed for #repo|escape#"/> | |
5 | <link rel="alternate" type="application/rss+xml" |
|
5 | <link rel="alternate" type="application/rss+xml" | |
6 | href="{url}rss-log" title="RSS feed for #repo|escape#"/> |
|
6 | href="{url}rss-log" title="RSS feed for #repo|escape#"/> | |
7 | <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]--> |
|
7 | <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]--> | |
8 | </head> |
|
8 | </head> | |
9 | <body> |
|
9 | <body> | |
10 |
|
10 | |||
11 | <div class="page_header"> |
|
11 | <div class="page_header"> | |
12 | <a href="http://www.selenic.com/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">#repo|escape#</a> / graph |
|
12 | <a href="http://www.selenic.com/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">#repo|escape#</a> / graph | |
13 | </div> |
|
13 | </div> | |
14 |
|
14 | |||
15 | <form action="{url}log"> |
|
15 | <form action="{url}log"> | |
16 | {sessionvars%hiddenformentry} |
|
16 | {sessionvars%hiddenformentry} | |
17 | <div class="search"> |
|
17 | <div class="search"> | |
18 | <input type="text" name="rev" /> |
|
18 | <input type="text" name="rev" /> | |
19 | </div> |
|
19 | </div> | |
20 | </form> |
|
20 | </form> | |
21 | <div class="page_nav"> |
|
21 | <div class="page_nav"> | |
22 | <a href="{url}summary{sessionvars%urlparameter}">summary</a> | |
|
22 | <a href="{url}summary{sessionvars%urlparameter}">summary</a> | | |
23 | <a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a> | |
|
23 | <a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a> | | |
24 | <a href="{url}log/#rev#{sessionvars%urlparameter}">changelog</a> | |
|
24 | <a href="{url}log/#rev#{sessionvars%urlparameter}">changelog</a> | | |
25 | graph | |
|
25 | graph | | |
26 | <a href="{url}tags{sessionvars%urlparameter}">tags</a> | |
|
26 | <a href="{url}tags{sessionvars%urlparameter}">tags</a> | | |
27 | <a href="{url}file/#node|short#{sessionvars%urlparameter}">files</a> |
|
27 | <a href="{url}file/#node|short#{sessionvars%urlparameter}">files</a> | |
28 | <br/> |
|
28 | <br/> | |
29 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> |
|
29 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> | |
30 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> |
|
30 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> | |
31 | | #changenav%navgraphentry#<br/> |
|
31 | | #changenav%navgraphentry#<br/> | |
32 | </div> |
|
32 | </div> | |
33 |
|
33 | |||
34 | <div class="title"> </div> |
|
34 | <div class="title"> </div> | |
35 |
|
35 | |||
36 | <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript> |
|
36 | <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript> | |
37 |
|
37 | |||
38 | <div id="wrapper"> |
|
38 | <div id="wrapper"> | |
39 | <ul id="nodebgs"></ul> |
|
39 | <ul id="nodebgs"></ul> | |
40 | <canvas id="graph" width="224" height="#canvasheight#"></canvas> |
|
40 | <canvas id="graph" width="224" height="#canvasheight#"></canvas> | |
41 | <ul id="graphnodes"></ul> |
|
41 | <ul id="graphnodes"></ul> | |
42 | </div> |
|
42 | </div> | |
43 |
|
43 | |||
44 | <script type="text/javascript" src="#staticurl#graph.js"></script> |
|
44 | <script type="text/javascript" src="#staticurl#graph.js"></script> | |
45 | <script> |
|
45 | <script> | |
46 | <!-- hide script content |
|
46 | <!-- hide script content | |
47 |
|
47 | |||
48 | var data = {jsdata|json}; |
|
48 | var data = {jsdata|json}; | |
49 | var graph = new Graph(); |
|
49 | var graph = new Graph(); | |
50 | graph.scale({bg_height}); |
|
50 | graph.scale({bg_height}); | |
51 |
|
51 | |||
52 | graph.edge = function(x0, y0, x1, y1, color) { |
|
52 | graph.edge = function(x0, y0, x1, y1, color) { | |
53 |
|
53 | |||
54 | this.setColor(color, 0.0, 0.65); |
|
54 | this.setColor(color, 0.0, 0.65); | |
55 | this.ctx.beginPath(); |
|
55 | this.ctx.beginPath(); | |
56 | this.ctx.moveTo(x0, y0); |
|
56 | this.ctx.moveTo(x0, y0); | |
57 | this.ctx.lineTo(x1, y1); |
|
57 | this.ctx.lineTo(x1, y1); | |
58 | this.ctx.stroke(); |
|
58 | this.ctx.stroke(); | |
59 |
|
59 | |||
60 | } |
|
60 | } | |
61 |
|
61 | |||
62 | var revlink = '<li style="_STYLE"><span class="desc">'; |
|
62 | var revlink = '<li style="_STYLE"><span class="desc">'; | |
63 | revlink += '<a class="list" href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID"><b>_DESC</b></a>'; |
|
63 | revlink += '<a class="list" href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID"><b>_DESC</b></a>'; | |
64 | revlink += '</span> _TAGS'; |
|
64 | revlink += '</span> _TAGS'; | |
65 | revlink += '<span class="info">_DATE ago, by _USER</span></li>'; |
|
65 | revlink += '<span class="info">_DATE ago, by _USER</span></li>'; | |
66 |
|
66 | |||
67 | graph.vertex = function(x, y, color, parity, cur) { |
|
67 | graph.vertex = function(x, y, color, parity, cur) { | |
68 |
|
68 | |||
69 | this.ctx.beginPath(); |
|
69 | this.ctx.beginPath(); | |
70 | color = this.setColor(color, 0.25, 0.75); |
|
70 | color = this.setColor(color, 0.25, 0.75); | |
71 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); |
|
71 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); | |
72 | this.ctx.fill(); |
|
72 | this.ctx.fill(); | |
73 |
|
73 | |||
74 | var bg = '<li class="bg parity' + parity + '"></li>'; |
|
74 | var bg = '<li class="bg parity' + parity + '"></li>'; | |
75 | var left = (this.columns + 1) * this.bg_height; |
|
75 | var left = (this.columns + 1) * this.bg_height; | |
76 | var nstyle = 'padding-left: ' + left + 'px;'; |
|
76 | var nstyle = 'padding-left: ' + left + 'px;'; | |
77 | var item = revlink.replace(/_STYLE/, nstyle); |
|
77 | var item = revlink.replace(/_STYLE/, nstyle); | |
78 | item = item.replace(/_PARITY/, 'parity' + parity); |
|
78 | item = item.replace(/_PARITY/, 'parity' + parity); | |
79 | item = item.replace(/_NODEID/, cur[0]); |
|
79 | item = item.replace(/_NODEID/, cur[0]); | |
80 | item = item.replace(/_NODEID/, cur[0]); |
|
80 | item = item.replace(/_NODEID/, cur[0]); | |
81 | if (cur[3] != '') |
|
81 | item = item.replace(/_DESC/, cur[3]); | |
82 | item = item.replace(/_DESC/, cur[3]); |
|
|||
83 | else |
|
|||
84 | item = item.replace(/_DESC/, '(none)'); |
|
|||
85 | item = item.replace(/_USER/, cur[4]); |
|
82 | item = item.replace(/_USER/, cur[4]); | |
86 | item = item.replace(/_DATE/, cur[5]); |
|
83 | item = item.replace(/_DATE/, cur[5]); | |
87 |
|
84 | |||
88 | var tagspan = ''; |
|
85 | var tagspan = ''; | |
89 | if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { |
|
86 | if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { | |
90 | tagspan = '<span class="logtags">'; |
|
87 | tagspan = '<span class="logtags">'; | |
91 | if (cur[6][1]) { |
|
88 | if (cur[6][1]) { | |
92 | tagspan += '<span class="branchtag" title="' + cur[6][0] + '">'; |
|
89 | tagspan += '<span class="branchtag" title="' + cur[6][0] + '">'; | |
93 | tagspan += cur[6][0] + '</span> '; |
|
90 | tagspan += cur[6][0] + '</span> '; | |
94 | } else if (!cur[6][1] && cur[6][0] != 'default') { |
|
91 | } else if (!cur[6][1] && cur[6][0] != 'default') { | |
95 | tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">'; |
|
92 | tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">'; | |
96 | tagspan += cur[6][0] + '</span> '; |
|
93 | tagspan += cur[6][0] + '</span> '; | |
97 | } |
|
94 | } | |
98 | if (cur[7].length) { |
|
95 | if (cur[7].length) { | |
99 | for (var t in cur[7]) { |
|
96 | for (var t in cur[7]) { | |
100 | var tag = cur[7][t]; |
|
97 | var tag = cur[7][t]; | |
101 | tagspan += '<span class="tagtag">' + tag + '</span> '; |
|
98 | tagspan += '<span class="tagtag">' + tag + '</span> '; | |
102 | } |
|
99 | } | |
103 | } |
|
100 | } | |
104 | tagspan += '</span>'; |
|
101 | tagspan += '</span>'; | |
105 | } |
|
102 | } | |
106 |
|
103 | |||
107 | item = item.replace(/_TAGS/, tagspan); |
|
104 | item = item.replace(/_TAGS/, tagspan); | |
108 | return [bg, item]; |
|
105 | return [bg, item]; | |
109 |
|
106 | |||
110 | } |
|
107 | } | |
111 |
|
108 | |||
112 | graph.render(data); |
|
109 | graph.render(data); | |
113 |
|
110 | |||
114 | // stop hiding script --> |
|
111 | // stop hiding script --> | |
115 | </script> |
|
112 | </script> | |
116 |
|
113 | |||
117 | <div class="page_nav"> |
|
114 | <div class="page_nav"> | |
118 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> |
|
115 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> | |
119 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> |
|
116 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> | |
120 | | {changenav%navgraphentry} |
|
117 | | {changenav%navgraphentry} | |
121 | </div> |
|
118 | </div> | |
122 |
|
119 | |||
123 | #footer# |
|
120 | #footer# |
@@ -1,120 +1,117 b'' | |||||
1 | #header# |
|
1 | #header# | |
2 | <title>#repo|escape#: graph</title> |
|
2 | <title>#repo|escape#: graph</title> | |
3 | <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for #repo|escape#"/> |
|
3 | <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for #repo|escape#"/> | |
4 | <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for #repo|escape#"/> |
|
4 | <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for #repo|escape#"/> | |
5 | <!--[if IE]><script type="text/javascript" src="#staticurl#excanvas.js"></script><![endif]--> |
|
5 | <!--[if IE]><script type="text/javascript" src="#staticurl#excanvas.js"></script><![endif]--> | |
6 | </head> |
|
6 | </head> | |
7 |
|
7 | |||
8 | <body> |
|
8 | <body> | |
9 | <div id="container"> |
|
9 | <div id="container"> | |
10 | <div class="page-header"> |
|
10 | <div class="page-header"> | |
11 | <h1><a href="{url}summary{sessionvars%urlparameter}">#repo|escape#</a> / graph</h1> |
|
11 | <h1><a href="{url}summary{sessionvars%urlparameter}">#repo|escape#</a> / graph</h1> | |
12 |
|
12 | |||
13 | <form action="{url}log"> |
|
13 | <form action="{url}log"> | |
14 | {sessionvars%hiddenformentry} |
|
14 | {sessionvars%hiddenformentry} | |
15 | <dl class="search"> |
|
15 | <dl class="search"> | |
16 | <dt><label>Search: </label></dt> |
|
16 | <dt><label>Search: </label></dt> | |
17 | <dd><input type="text" name="rev" /></dd> |
|
17 | <dd><input type="text" name="rev" /></dd> | |
18 | </dl> |
|
18 | </dl> | |
19 | </form> |
|
19 | </form> | |
20 |
|
20 | |||
21 | <ul class="page-nav"> |
|
21 | <ul class="page-nav"> | |
22 | <li><a href="{url}summary{sessionvars%urlparameter}">summary</a></li> |
|
22 | <li><a href="{url}summary{sessionvars%urlparameter}">summary</a></li> | |
23 | <li><a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a></li> |
|
23 | <li><a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a></li> | |
24 | <li><a href="{url}changelog{sessionvars%urlparameter}">changelog</a></li> |
|
24 | <li><a href="{url}changelog{sessionvars%urlparameter}">changelog</a></li> | |
25 | <li class="current">graph</li> |
|
25 | <li class="current">graph</li> | |
26 | <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> |
|
26 | <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> | |
27 | <li><a href="{url}file/#node|short#{sessionvars%urlparameter}">files</a></li> |
|
27 | <li><a href="{url}file/#node|short#{sessionvars%urlparameter}">files</a></li> | |
28 | </ul> |
|
28 | </ul> | |
29 | </div> |
|
29 | </div> | |
30 |
|
30 | |||
31 | <h2 class="no-link no-border">graph</h2> |
|
31 | <h2 class="no-link no-border">graph</h2> | |
32 |
|
32 | |||
33 | <div id="noscript">The revision graph only works with JavaScript-enabled browsers.</div> |
|
33 | <div id="noscript">The revision graph only works with JavaScript-enabled browsers.</div> | |
34 | <div id="wrapper"> |
|
34 | <div id="wrapper"> | |
35 | <ul id="nodebgs"></ul> |
|
35 | <ul id="nodebgs"></ul> | |
36 | <canvas id="graph" width="224" height="#canvasheight#"></canvas> |
|
36 | <canvas id="graph" width="224" height="#canvasheight#"></canvas> | |
37 | <ul id="graphnodes"></ul> |
|
37 | <ul id="graphnodes"></ul> | |
38 | </div> |
|
38 | </div> | |
39 |
|
39 | |||
40 | <script type="text/javascript" src="#staticurl#graph.js"></script> |
|
40 | <script type="text/javascript" src="#staticurl#graph.js"></script> | |
41 | <script> |
|
41 | <script> | |
42 | <!-- hide script content |
|
42 | <!-- hide script content | |
43 |
|
43 | |||
44 | document.getElementById('noscript').style.display = 'none'; |
|
44 | document.getElementById('noscript').style.display = 'none'; | |
45 |
|
45 | |||
46 | var data = {jsdata|json}; |
|
46 | var data = {jsdata|json}; | |
47 | var graph = new Graph(); |
|
47 | var graph = new Graph(); | |
48 | graph.scale({bg_height}); |
|
48 | graph.scale({bg_height}); | |
49 |
|
49 | |||
50 | graph.edge = function(x0, y0, x1, y1, color) { |
|
50 | graph.edge = function(x0, y0, x1, y1, color) { | |
51 |
|
51 | |||
52 | this.setColor(color, 0.0, 0.65); |
|
52 | this.setColor(color, 0.0, 0.65); | |
53 | this.ctx.beginPath(); |
|
53 | this.ctx.beginPath(); | |
54 | this.ctx.moveTo(x0, y0); |
|
54 | this.ctx.moveTo(x0, y0); | |
55 | this.ctx.lineTo(x1, y1); |
|
55 | this.ctx.lineTo(x1, y1); | |
56 | this.ctx.stroke(); |
|
56 | this.ctx.stroke(); | |
57 |
|
57 | |||
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | var revlink = '<li style="_STYLE"><span class="desc">'; |
|
60 | var revlink = '<li style="_STYLE"><span class="desc">'; | |
61 | revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>'; |
|
61 | revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>'; | |
62 | revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>'; |
|
62 | revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>'; | |
63 |
|
63 | |||
64 | graph.vertex = function(x, y, color, parity, cur) { |
|
64 | graph.vertex = function(x, y, color, parity, cur) { | |
65 |
|
65 | |||
66 | this.ctx.beginPath(); |
|
66 | this.ctx.beginPath(); | |
67 | color = this.setColor(color, 0.25, 0.75); |
|
67 | color = this.setColor(color, 0.25, 0.75); | |
68 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); |
|
68 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); | |
69 | this.ctx.fill(); |
|
69 | this.ctx.fill(); | |
70 |
|
70 | |||
71 | var bg = '<li class="bg parity' + parity + '"></li>'; |
|
71 | var bg = '<li class="bg parity' + parity + '"></li>'; | |
72 | var left = (this.columns + 1) * this.bg_height; |
|
72 | var left = (this.columns + 1) * this.bg_height; | |
73 | var nstyle = 'padding-left: ' + left + 'px;'; |
|
73 | var nstyle = 'padding-left: ' + left + 'px;'; | |
74 | var item = revlink.replace(/_STYLE/, nstyle); |
|
74 | var item = revlink.replace(/_STYLE/, nstyle); | |
75 | item = item.replace(/_PARITY/, 'parity' + parity); |
|
75 | item = item.replace(/_PARITY/, 'parity' + parity); | |
76 | item = item.replace(/_NODEID/, cur[0]); |
|
76 | item = item.replace(/_NODEID/, cur[0]); | |
77 | item = item.replace(/_NODEID/, cur[0]); |
|
77 | item = item.replace(/_NODEID/, cur[0]); | |
78 | if (cur[3] != '') |
|
78 | item = item.replace(/_DESC/, cur[3]); | |
79 | item = item.replace(/_DESC/, cur[3]); |
|
|||
80 | else |
|
|||
81 | item = item.replace(/_DESC/, '(none)'); |
|
|||
82 | item = item.replace(/_USER/, cur[4]); |
|
79 | item = item.replace(/_USER/, cur[4]); | |
83 | item = item.replace(/_DATE/, cur[5]); |
|
80 | item = item.replace(/_DATE/, cur[5]); | |
84 |
|
81 | |||
85 | var tagspan = ''; |
|
82 | var tagspan = ''; | |
86 | if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { |
|
83 | if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { | |
87 | tagspan = '<span class="logtags">'; |
|
84 | tagspan = '<span class="logtags">'; | |
88 | if (cur[6][1]) { |
|
85 | if (cur[6][1]) { | |
89 | tagspan += '<span class="branchtag" title="' + cur[6][0] + '">'; |
|
86 | tagspan += '<span class="branchtag" title="' + cur[6][0] + '">'; | |
90 | tagspan += cur[6][0] + '</span> '; |
|
87 | tagspan += cur[6][0] + '</span> '; | |
91 | } else if (!cur[6][1] && cur[6][0] != 'default') { |
|
88 | } else if (!cur[6][1] && cur[6][0] != 'default') { | |
92 | tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">'; |
|
89 | tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">'; | |
93 | tagspan += cur[6][0] + '</span> '; |
|
90 | tagspan += cur[6][0] + '</span> '; | |
94 | } |
|
91 | } | |
95 | if (cur[7].length) { |
|
92 | if (cur[7].length) { | |
96 | for (var t in cur[7]) { |
|
93 | for (var t in cur[7]) { | |
97 | var tag = cur[7][t]; |
|
94 | var tag = cur[7][t]; | |
98 | tagspan += '<span class="tagtag">' + tag + '</span> '; |
|
95 | tagspan += '<span class="tagtag">' + tag + '</span> '; | |
99 | } |
|
96 | } | |
100 | } |
|
97 | } | |
101 | tagspan += '</span>'; |
|
98 | tagspan += '</span>'; | |
102 | } |
|
99 | } | |
103 |
|
100 | |||
104 | item = item.replace(/_TAGS/, tagspan); |
|
101 | item = item.replace(/_TAGS/, tagspan); | |
105 | return [bg, item]; |
|
102 | return [bg, item]; | |
106 |
|
103 | |||
107 | } |
|
104 | } | |
108 |
|
105 | |||
109 | graph.render(data); |
|
106 | graph.render(data); | |
110 |
|
107 | |||
111 | // stop hiding script --> |
|
108 | // stop hiding script --> | |
112 | </script> |
|
109 | </script> | |
113 |
|
110 | |||
114 | <div class="page-path"> |
|
111 | <div class="page-path"> | |
115 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> |
|
112 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> | |
116 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> |
|
113 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> | |
117 | | {changenav%navgraphentry} |
|
114 | | {changenav%navgraphentry} | |
118 | </div> |
|
115 | </div> | |
119 |
|
116 | |||
120 | #footer# |
|
117 | #footer# |
@@ -1,134 +1,131 b'' | |||||
1 | {header} |
|
1 | {header} | |
2 | <title>{repo|escape}: revision graph</title> |
|
2 | <title>{repo|escape}: revision graph</title> | |
3 | <link rel="alternate" type="application/atom+xml" |
|
3 | <link rel="alternate" type="application/atom+xml" | |
4 | href="{url}atom-log" title="Atom feed for {repo|escape}: log" /> |
|
4 | href="{url}atom-log" title="Atom feed for {repo|escape}: log" /> | |
5 | <link rel="alternate" type="application/rss+xml" |
|
5 | <link rel="alternate" type="application/rss+xml" | |
6 | href="{url}rss-log" title="RSS feed for {repo|escape}: log" /> |
|
6 | href="{url}rss-log" title="RSS feed for {repo|escape}: log" /> | |
7 | <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]--> |
|
7 | <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]--> | |
8 | </head> |
|
8 | </head> | |
9 | <body> |
|
9 | <body> | |
10 |
|
10 | |||
11 | <div class="container"> |
|
11 | <div class="container"> | |
12 | <div class="menu"> |
|
12 | <div class="menu"> | |
13 | <div class="logo"> |
|
13 | <div class="logo"> | |
14 | <a href="http://www.selenic.com/mercurial/"> |
|
14 | <a href="http://www.selenic.com/mercurial/"> | |
15 | <img src="{staticurl}hglogo.png" alt="mercurial" /></a> |
|
15 | <img src="{staticurl}hglogo.png" alt="mercurial" /></a> | |
16 | </div> |
|
16 | </div> | |
17 | <ul> |
|
17 | <ul> | |
18 | <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> |
|
18 | <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> | |
19 | <li class="active">graph</li> |
|
19 | <li class="active">graph</li> | |
20 | <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> |
|
20 | <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> | |
21 | </ul> |
|
21 | </ul> | |
22 | <ul> |
|
22 | <ul> | |
23 | <li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li> |
|
23 | <li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li> | |
24 | <li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li> |
|
24 | <li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li> | |
25 | </ul> |
|
25 | </ul> | |
26 | </div> |
|
26 | </div> | |
27 |
|
27 | |||
28 | <div class="main"> |
|
28 | <div class="main"> | |
29 | <h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2> |
|
29 | <h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2> | |
30 | <h3>graph</h3> |
|
30 | <h3>graph</h3> | |
31 |
|
31 | |||
32 | <form class="search" action="{url}log"> |
|
32 | <form class="search" action="{url}log"> | |
33 | {sessionvars%hiddenformentry} |
|
33 | {sessionvars%hiddenformentry} | |
34 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
34 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
35 | <div id="hint">find changesets by author, revision, |
|
35 | <div id="hint">find changesets by author, revision, | |
36 | files, or words in the commit message</div> |
|
36 | files, or words in the commit message</div> | |
37 | </form> |
|
37 | </form> | |
38 |
|
38 | |||
39 | <div class="navigate"> |
|
39 | <div class="navigate"> | |
40 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> |
|
40 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> | |
41 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> |
|
41 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> | |
42 | | rev {rev}: {changenav%navgraphentry} |
|
42 | | rev {rev}: {changenav%navgraphentry} | |
43 | </div> |
|
43 | </div> | |
44 |
|
44 | |||
45 | <noscript><p>The revision graph only works with JavaScript-enabled browsers.</p></noscript> |
|
45 | <noscript><p>The revision graph only works with JavaScript-enabled browsers.</p></noscript> | |
46 |
|
46 | |||
47 | <div id="wrapper"> |
|
47 | <div id="wrapper"> | |
48 | <ul id="nodebgs"></ul> |
|
48 | <ul id="nodebgs"></ul> | |
49 | <canvas id="graph" width="224" height="{canvasheight}"></canvas> |
|
49 | <canvas id="graph" width="224" height="{canvasheight}"></canvas> | |
50 | <ul id="graphnodes"></ul> |
|
50 | <ul id="graphnodes"></ul> | |
51 | </div> |
|
51 | </div> | |
52 |
|
52 | |||
53 | <script type="text/javascript" src="{staticurl}graph.js"></script> |
|
53 | <script type="text/javascript" src="{staticurl}graph.js"></script> | |
54 | <script type="text/javascript"> |
|
54 | <script type="text/javascript"> | |
55 | <!-- hide script content |
|
55 | <!-- hide script content | |
56 |
|
56 | |||
57 | var data = {jsdata|json}; |
|
57 | var data = {jsdata|json}; | |
58 | var graph = new Graph(); |
|
58 | var graph = new Graph(); | |
59 | graph.scale({bg_height}); |
|
59 | graph.scale({bg_height}); | |
60 |
|
60 | |||
61 | graph.edge = function(x0, y0, x1, y1, color) { |
|
61 | graph.edge = function(x0, y0, x1, y1, color) { | |
62 |
|
62 | |||
63 | this.setColor(color, 0.0, 0.65); |
|
63 | this.setColor(color, 0.0, 0.65); | |
64 | this.ctx.beginPath(); |
|
64 | this.ctx.beginPath(); | |
65 | this.ctx.moveTo(x0, y0); |
|
65 | this.ctx.moveTo(x0, y0); | |
66 | this.ctx.lineTo(x1, y1); |
|
66 | this.ctx.lineTo(x1, y1); | |
67 | this.ctx.stroke(); |
|
67 | this.ctx.stroke(); | |
68 |
|
68 | |||
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | var revlink = '<li style="_STYLE"><span class="desc">'; |
|
71 | var revlink = '<li style="_STYLE"><span class="desc">'; | |
72 | revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>'; |
|
72 | revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>'; | |
73 | revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>'; |
|
73 | revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>'; | |
74 |
|
74 | |||
75 | graph.vertex = function(x, y, color, parity, cur) { |
|
75 | graph.vertex = function(x, y, color, parity, cur) { | |
76 |
|
76 | |||
77 | this.ctx.beginPath(); |
|
77 | this.ctx.beginPath(); | |
78 | color = this.setColor(color, 0.25, 0.75); |
|
78 | color = this.setColor(color, 0.25, 0.75); | |
79 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); |
|
79 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); | |
80 | this.ctx.fill(); |
|
80 | this.ctx.fill(); | |
81 |
|
81 | |||
82 | var bg = '<li class="bg parity' + parity + '"></li>'; |
|
82 | var bg = '<li class="bg parity' + parity + '"></li>'; | |
83 | var left = (this.columns + 1) * this.bg_height; |
|
83 | var left = (this.columns + 1) * this.bg_height; | |
84 | var nstyle = 'padding-left: ' + left + 'px;'; |
|
84 | var nstyle = 'padding-left: ' + left + 'px;'; | |
85 | var item = revlink.replace(/_STYLE/, nstyle); |
|
85 | var item = revlink.replace(/_STYLE/, nstyle); | |
86 | item = item.replace(/_PARITY/, 'parity' + parity); |
|
86 | item = item.replace(/_PARITY/, 'parity' + parity); | |
87 | item = item.replace(/_NODEID/, cur[0]); |
|
87 | item = item.replace(/_NODEID/, cur[0]); | |
88 | item = item.replace(/_NODEID/, cur[0]); |
|
88 | item = item.replace(/_NODEID/, cur[0]); | |
89 | if (cur[3] != '') |
|
89 | item = item.replace(/_DESC/, cur[3]); | |
90 | item = item.replace(/_DESC/, cur[3]); |
|
|||
91 | else |
|
|||
92 | item = item.replace(/_DESC/, '(none)'); |
|
|||
93 | item = item.replace(/_USER/, cur[4]); |
|
90 | item = item.replace(/_USER/, cur[4]); | |
94 | item = item.replace(/_DATE/, cur[5]); |
|
91 | item = item.replace(/_DATE/, cur[5]); | |
95 |
|
92 | |||
96 | var tagspan = ''; |
|
93 | var tagspan = ''; | |
97 | if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { |
|
94 | if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { | |
98 | tagspan = '<span class="logtags">'; |
|
95 | tagspan = '<span class="logtags">'; | |
99 | if (cur[6][1]) { |
|
96 | if (cur[6][1]) { | |
100 | tagspan += '<span class="branchhead" title="' + cur[6][0] + '">'; |
|
97 | tagspan += '<span class="branchhead" title="' + cur[6][0] + '">'; | |
101 | tagspan += cur[6][0] + '</span> '; |
|
98 | tagspan += cur[6][0] + '</span> '; | |
102 | } else if (!cur[6][1] && cur[6][0] != 'default') { |
|
99 | } else if (!cur[6][1] && cur[6][0] != 'default') { | |
103 | tagspan += '<span class="branchname" title="' + cur[6][0] + '">'; |
|
100 | tagspan += '<span class="branchname" title="' + cur[6][0] + '">'; | |
104 | tagspan += cur[6][0] + '</span> '; |
|
101 | tagspan += cur[6][0] + '</span> '; | |
105 | } |
|
102 | } | |
106 | if (cur[7].length) { |
|
103 | if (cur[7].length) { | |
107 | for (var t in cur[7]) { |
|
104 | for (var t in cur[7]) { | |
108 | var tag = cur[7][t]; |
|
105 | var tag = cur[7][t]; | |
109 | tagspan += '<span class="tag">' + tag + '</span> '; |
|
106 | tagspan += '<span class="tag">' + tag + '</span> '; | |
110 | } |
|
107 | } | |
111 | } |
|
108 | } | |
112 | tagspan += '</span>'; |
|
109 | tagspan += '</span>'; | |
113 | } |
|
110 | } | |
114 |
|
111 | |||
115 | item = item.replace(/_TAGS/, tagspan); |
|
112 | item = item.replace(/_TAGS/, tagspan); | |
116 | return [bg, item]; |
|
113 | return [bg, item]; | |
117 |
|
114 | |||
118 | } |
|
115 | } | |
119 |
|
116 | |||
120 | graph.render(data); |
|
117 | graph.render(data); | |
121 |
|
118 | |||
122 | // stop hiding script --> |
|
119 | // stop hiding script --> | |
123 | </script> |
|
120 | </script> | |
124 |
|
121 | |||
125 | <div class="navigate"> |
|
122 | <div class="navigate"> | |
126 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> |
|
123 | <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a> | |
127 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> |
|
124 | <a href="{url}graph/{rev}{morevars%urlparameter}">more</a> | |
128 | | rev {rev}: {changenav%navgraphentry} |
|
125 | | rev {rev}: {changenav%navgraphentry} | |
129 | </div> |
|
126 | </div> | |
130 |
|
127 | |||
131 | </div> |
|
128 | </div> | |
132 | </div> |
|
129 | </div> | |
133 |
|
130 | |||
134 | {footer} |
|
131 | {footer} |
@@ -1,98 +1,95 b'' | |||||
1 | #header# |
|
1 | #header# | |
2 | <title>#repo|escape#: graph</title> |
|
2 | <title>#repo|escape#: graph</title> | |
3 | <link rel="alternate" type="application/atom+xml" |
|
3 | <link rel="alternate" type="application/atom+xml" | |
4 | href="#url#atom-tags" title="Atom feed for #repo|escape#: tags"> |
|
4 | href="#url#atom-tags" title="Atom feed for #repo|escape#: tags"> | |
5 | <link rel="alternate" type="application/rss+xml" |
|
5 | <link rel="alternate" type="application/rss+xml" | |
6 | href="#url#rss-tags" title="RSS feed for #repo|escape#: tags"> |
|
6 | href="#url#rss-tags" title="RSS feed for #repo|escape#: tags"> | |
7 | <!--[if IE]><script type="text/javascript" src="#staticurl#excanvas.js"></script><![endif]--> |
|
7 | <!--[if IE]><script type="text/javascript" src="#staticurl#excanvas.js"></script><![endif]--> | |
8 | </head> |
|
8 | </head> | |
9 | <body> |
|
9 | <body> | |
10 |
|
10 | |||
11 | <div class="buttons"> |
|
11 | <div class="buttons"> | |
12 | <a href="#url#log{sessionvars%urlparameter}">changelog</a> |
|
12 | <a href="#url#log{sessionvars%urlparameter}">changelog</a> | |
13 | <a href="#url#shortlog{sessionvars%urlparameter}">shortlog</a> |
|
13 | <a href="#url#shortlog{sessionvars%urlparameter}">shortlog</a> | |
14 | <a href="#url#tags{sessionvars%urlparameter}">tags</a> |
|
14 | <a href="#url#tags{sessionvars%urlparameter}">tags</a> | |
15 | <a href="#url#file/#node|short#/{sessionvars%urlparameter}">files</a> |
|
15 | <a href="#url#file/#node|short#/{sessionvars%urlparameter}">files</a> | |
16 | </div> |
|
16 | </div> | |
17 |
|
17 | |||
18 | <h2>graph</h2> |
|
18 | <h2>graph</h2> | |
19 |
|
19 | |||
20 | <form action="#url#log"> |
|
20 | <form action="#url#log"> | |
21 | {sessionvars%hiddenformentry} |
|
21 | {sessionvars%hiddenformentry} | |
22 | <p> |
|
22 | <p> | |
23 | <label for="search1">search:</label> |
|
23 | <label for="search1">search:</label> | |
24 | <input name="rev" id="search1" type="text" size="30"> |
|
24 | <input name="rev" id="search1" type="text" size="30"> | |
25 | navigate: <small class="navigate">#changenav%navgraphentry#</small> |
|
25 | navigate: <small class="navigate">#changenav%navgraphentry#</small> | |
26 | </p> |
|
26 | </p> | |
27 | </form> |
|
27 | </form> | |
28 |
|
28 | |||
29 | <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript> |
|
29 | <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript> | |
30 |
|
30 | |||
31 | <div id="wrapper"> |
|
31 | <div id="wrapper"> | |
32 | <ul id="nodebgs"></ul> |
|
32 | <ul id="nodebgs"></ul> | |
33 | <canvas id="graph" width="224" height="#canvasheight#"></canvas> |
|
33 | <canvas id="graph" width="224" height="#canvasheight#"></canvas> | |
34 | <ul id="graphnodes"></ul> |
|
34 | <ul id="graphnodes"></ul> | |
35 | </div> |
|
35 | </div> | |
36 |
|
36 | |||
37 | <script type="text/javascript" src="#staticurl#graph.js"></script> |
|
37 | <script type="text/javascript" src="#staticurl#graph.js"></script> | |
38 | <script type="text/javascript"> |
|
38 | <script type="text/javascript"> | |
39 | <!-- hide script content |
|
39 | <!-- hide script content | |
40 |
|
40 | |||
41 | var data = {jsdata|json}; |
|
41 | var data = {jsdata|json}; | |
42 | var graph = new Graph(); |
|
42 | var graph = new Graph(); | |
43 | graph.scale({bg_height}); |
|
43 | graph.scale({bg_height}); | |
44 |
|
44 | |||
45 | graph.edge = function(x0, y0, x1, y1, color) { |
|
45 | graph.edge = function(x0, y0, x1, y1, color) { | |
46 |
|
46 | |||
47 | this.setColor(color, 0.0, 0.65); |
|
47 | this.setColor(color, 0.0, 0.65); | |
48 | this.ctx.beginPath(); |
|
48 | this.ctx.beginPath(); | |
49 | this.ctx.moveTo(x0, y0); |
|
49 | this.ctx.moveTo(x0, y0); | |
50 | this.ctx.lineTo(x1, y1); |
|
50 | this.ctx.lineTo(x1, y1); | |
51 | this.ctx.stroke(); |
|
51 | this.ctx.stroke(); | |
52 |
|
52 | |||
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | var revlink = '<li style="_STYLE"><span class="desc">'; |
|
55 | var revlink = '<li style="_STYLE"><span class="desc">'; | |
56 | revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>'; |
|
56 | revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>'; | |
57 | revlink += '</span><span class="info">_DATE ago, by _USER</span></li>'; |
|
57 | revlink += '</span><span class="info">_DATE ago, by _USER</span></li>'; | |
58 |
|
58 | |||
59 | graph.vertex = function(x, y, color, parity, cur) { |
|
59 | graph.vertex = function(x, y, color, parity, cur) { | |
60 |
|
60 | |||
61 | this.ctx.beginPath(); |
|
61 | this.ctx.beginPath(); | |
62 | color = this.setColor(color, 0.25, 0.75); |
|
62 | color = this.setColor(color, 0.25, 0.75); | |
63 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); |
|
63 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); | |
64 | this.ctx.fill(); |
|
64 | this.ctx.fill(); | |
65 |
|
65 | |||
66 | var bg = '<li class="bg parity' + parity + '"></li>'; |
|
66 | var bg = '<li class="bg parity' + parity + '"></li>'; | |
67 | var left = (this.columns + 1) * this.bg_height; |
|
67 | var left = (this.columns + 1) * this.bg_height; | |
68 | var nstyle = 'padding-left: ' + left + 'px;'; |
|
68 | var nstyle = 'padding-left: ' + left + 'px;'; | |
69 | var item = revlink.replace(/_STYLE/, nstyle); |
|
69 | var item = revlink.replace(/_STYLE/, nstyle); | |
70 | item = item.replace(/_PARITY/, 'parity' + parity); |
|
70 | item = item.replace(/_PARITY/, 'parity' + parity); | |
71 | item = item.replace(/_NODEID/, cur[0]); |
|
71 | item = item.replace(/_NODEID/, cur[0]); | |
72 | item = item.replace(/_NODEID/, cur[0]); |
|
72 | item = item.replace(/_NODEID/, cur[0]); | |
73 | if (cur[3] != '') |
|
73 | item = item.replace(/_DESC/, cur[3]); | |
74 | item = item.replace(/_DESC/, cur[3]); |
|
|||
75 | else |
|
|||
76 | item = item.replace(/_DESC/, '(none)'); |
|
|||
77 | item = item.replace(/_USER/, cur[4]); |
|
74 | item = item.replace(/_USER/, cur[4]); | |
78 | item = item.replace(/_DATE/, cur[5]); |
|
75 | item = item.replace(/_DATE/, cur[5]); | |
79 |
|
76 | |||
80 | return [bg, item]; |
|
77 | return [bg, item]; | |
81 |
|
78 | |||
82 | } |
|
79 | } | |
83 |
|
80 | |||
84 | graph.render(data); |
|
81 | graph.render(data); | |
85 |
|
82 | |||
86 | // stop hiding script --> |
|
83 | // stop hiding script --> | |
87 | </script> |
|
84 | </script> | |
88 |
|
85 | |||
89 | <form action="#url#log"> |
|
86 | <form action="#url#log"> | |
90 | {sessionvars%hiddenformentry} |
|
87 | {sessionvars%hiddenformentry} | |
91 | <p> |
|
88 | <p> | |
92 | <label for="search1">search:</label> |
|
89 | <label for="search1">search:</label> | |
93 | <input name="rev" id="search1" type="text" size="30"> |
|
90 | <input name="rev" id="search1" type="text" size="30"> | |
94 | navigate: <small class="navigate">#changenav%navgraphentry#</small> |
|
91 | navigate: <small class="navigate">#changenav%navgraphentry#</small> | |
95 | </p> |
|
92 | </p> | |
96 | </form> |
|
93 | </form> | |
97 |
|
94 | |||
98 | #footer# |
|
95 | #footer# |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,347 +1,344 b'' | |||||
1 | 200 Script output follows |
|
1 | 200 Script output follows | |
2 |
|
2 | |||
3 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
5 | <head> |
|
5 | <head> | |
6 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
6 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
7 | <meta name="robots" content="index, nofollow" /> |
|
7 | <meta name="robots" content="index, nofollow" /> | |
8 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
8 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
9 |
|
9 | |||
10 | <title>test: log</title> |
|
10 | <title>test: log</title> | |
11 | <link rel="alternate" type="application/atom+xml" |
|
11 | <link rel="alternate" type="application/atom+xml" | |
12 | href="/atom-log" title="Atom feed for test" /> |
|
12 | href="/atom-log" title="Atom feed for test" /> | |
13 | <link rel="alternate" type="application/rss+xml" |
|
13 | <link rel="alternate" type="application/rss+xml" | |
14 | href="/rss-log" title="RSS feed for test" /> |
|
14 | href="/rss-log" title="RSS feed for test" /> | |
15 | </head> |
|
15 | </head> | |
16 | <body> |
|
16 | <body> | |
17 |
|
17 | |||
18 | <div class="container"> |
|
18 | <div class="container"> | |
19 | <div class="menu"> |
|
19 | <div class="menu"> | |
20 | <div class="logo"> |
|
20 | <div class="logo"> | |
21 | <a href="http://www.selenic.com/mercurial/"> |
|
21 | <a href="http://www.selenic.com/mercurial/"> | |
22 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
22 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
23 | </div> |
|
23 | </div> | |
24 | <ul> |
|
24 | <ul> | |
25 | <li class="active">log</li> |
|
25 | <li class="active">log</li> | |
26 | <li><a href="/graph/000000000000">graph</a></li> |
|
26 | <li><a href="/graph/000000000000">graph</a></li> | |
27 | <li><a href="/tags">tags</a></li> |
|
27 | <li><a href="/tags">tags</a></li> | |
28 | </ul> |
|
28 | </ul> | |
29 | <ul> |
|
29 | <ul> | |
30 | <li><a href="/rev/000000000000">changeset</a></li> |
|
30 | <li><a href="/rev/000000000000">changeset</a></li> | |
31 | <li><a href="/file/000000000000">browse</a></li> |
|
31 | <li><a href="/file/000000000000">browse</a></li> | |
32 | </ul> |
|
32 | </ul> | |
33 | <ul> |
|
33 | <ul> | |
34 |
|
34 | |||
35 | </ul> |
|
35 | </ul> | |
36 | </div> |
|
36 | </div> | |
37 |
|
37 | |||
38 | <div class="main"> |
|
38 | <div class="main"> | |
39 | <h2><a href="/">test</a></h2> |
|
39 | <h2><a href="/">test</a></h2> | |
40 | <h3>log</h3> |
|
40 | <h3>log</h3> | |
41 |
|
41 | |||
42 | <form class="search" action="/log"> |
|
42 | <form class="search" action="/log"> | |
43 |
|
43 | |||
44 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
44 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
45 | <div id="hint">find changesets by author, revision, |
|
45 | <div id="hint">find changesets by author, revision, | |
46 | files, or words in the commit message</div> |
|
46 | files, or words in the commit message</div> | |
47 | </form> |
|
47 | </form> | |
48 |
|
48 | |||
49 | <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div> |
|
49 | <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div> | |
50 |
|
50 | |||
51 | <table class="bigtable"> |
|
51 | <table class="bigtable"> | |
52 | <tr> |
|
52 | <tr> | |
53 | <th class="age">age</th> |
|
53 | <th class="age">age</th> | |
54 | <th class="author">author</th> |
|
54 | <th class="author">author</th> | |
55 | <th class="description">description</th> |
|
55 | <th class="description">description</th> | |
56 | </tr> |
|
56 | </tr> | |
57 |
|
57 | |||
58 | </table> |
|
58 | </table> | |
59 |
|
59 | |||
60 | <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div> |
|
60 | <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div> | |
61 | </div> |
|
61 | </div> | |
62 | </div> |
|
62 | </div> | |
63 |
|
63 | |||
64 |
|
64 | |||
65 |
|
65 | |||
66 | </body> |
|
66 | </body> | |
67 | </html> |
|
67 | </html> | |
68 |
|
68 | |||
69 | 200 Script output follows |
|
69 | 200 Script output follows | |
70 |
|
70 | |||
71 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
71 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
72 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
72 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
73 | <head> |
|
73 | <head> | |
74 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
74 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
75 | <meta name="robots" content="index, nofollow" /> |
|
75 | <meta name="robots" content="index, nofollow" /> | |
76 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
76 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
77 |
|
77 | |||
78 | <title>test: log</title> |
|
78 | <title>test: log</title> | |
79 | <link rel="alternate" type="application/atom+xml" |
|
79 | <link rel="alternate" type="application/atom+xml" | |
80 | href="/atom-log" title="Atom feed for test" /> |
|
80 | href="/atom-log" title="Atom feed for test" /> | |
81 | <link rel="alternate" type="application/rss+xml" |
|
81 | <link rel="alternate" type="application/rss+xml" | |
82 | href="/rss-log" title="RSS feed for test" /> |
|
82 | href="/rss-log" title="RSS feed for test" /> | |
83 | </head> |
|
83 | </head> | |
84 | <body> |
|
84 | <body> | |
85 |
|
85 | |||
86 | <div class="container"> |
|
86 | <div class="container"> | |
87 | <div class="menu"> |
|
87 | <div class="menu"> | |
88 | <div class="logo"> |
|
88 | <div class="logo"> | |
89 | <a href="http://www.selenic.com/mercurial/"> |
|
89 | <a href="http://www.selenic.com/mercurial/"> | |
90 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
90 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
91 | </div> |
|
91 | </div> | |
92 | <ul> |
|
92 | <ul> | |
93 | <li class="active">log</li> |
|
93 | <li class="active">log</li> | |
94 | <li><a href="/graph/000000000000">graph</a></li> |
|
94 | <li><a href="/graph/000000000000">graph</a></li> | |
95 | <li><a href="/tags">tags</a></li> |
|
95 | <li><a href="/tags">tags</a></li> | |
96 | </ul> |
|
96 | </ul> | |
97 | <ul> |
|
97 | <ul> | |
98 | <li><a href="/rev/000000000000">changeset</a></li> |
|
98 | <li><a href="/rev/000000000000">changeset</a></li> | |
99 | <li><a href="/file/000000000000">browse</a></li> |
|
99 | <li><a href="/file/000000000000">browse</a></li> | |
100 | </ul> |
|
100 | </ul> | |
101 | <ul> |
|
101 | <ul> | |
102 |
|
102 | |||
103 | </ul> |
|
103 | </ul> | |
104 | </div> |
|
104 | </div> | |
105 |
|
105 | |||
106 | <div class="main"> |
|
106 | <div class="main"> | |
107 | <h2><a href="/">test</a></h2> |
|
107 | <h2><a href="/">test</a></h2> | |
108 | <h3>log</h3> |
|
108 | <h3>log</h3> | |
109 |
|
109 | |||
110 | <form class="search" action="/log"> |
|
110 | <form class="search" action="/log"> | |
111 |
|
111 | |||
112 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
112 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
113 | <div id="hint">find changesets by author, revision, |
|
113 | <div id="hint">find changesets by author, revision, | |
114 | files, or words in the commit message</div> |
|
114 | files, or words in the commit message</div> | |
115 | </form> |
|
115 | </form> | |
116 |
|
116 | |||
117 | <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div> |
|
117 | <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div> | |
118 |
|
118 | |||
119 | <table class="bigtable"> |
|
119 | <table class="bigtable"> | |
120 | <tr> |
|
120 | <tr> | |
121 | <th class="age">age</th> |
|
121 | <th class="age">age</th> | |
122 | <th class="author">author</th> |
|
122 | <th class="author">author</th> | |
123 | <th class="description">description</th> |
|
123 | <th class="description">description</th> | |
124 | </tr> |
|
124 | </tr> | |
125 |
|
125 | |||
126 | </table> |
|
126 | </table> | |
127 |
|
127 | |||
128 | <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div> |
|
128 | <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div> | |
129 | </div> |
|
129 | </div> | |
130 | </div> |
|
130 | </div> | |
131 |
|
131 | |||
132 |
|
132 | |||
133 |
|
133 | |||
134 | </body> |
|
134 | </body> | |
135 | </html> |
|
135 | </html> | |
136 |
|
136 | |||
137 | 200 Script output follows |
|
137 | 200 Script output follows | |
138 |
|
138 | |||
139 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
139 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
140 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
140 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
141 | <head> |
|
141 | <head> | |
142 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
142 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
143 | <meta name="robots" content="index, nofollow" /> |
|
143 | <meta name="robots" content="index, nofollow" /> | |
144 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
144 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
145 |
|
145 | |||
146 | <title>test: revision graph</title> |
|
146 | <title>test: revision graph</title> | |
147 | <link rel="alternate" type="application/atom+xml" |
|
147 | <link rel="alternate" type="application/atom+xml" | |
148 | href="/atom-log" title="Atom feed for test: log" /> |
|
148 | href="/atom-log" title="Atom feed for test: log" /> | |
149 | <link rel="alternate" type="application/rss+xml" |
|
149 | <link rel="alternate" type="application/rss+xml" | |
150 | href="/rss-log" title="RSS feed for test: log" /> |
|
150 | href="/rss-log" title="RSS feed for test: log" /> | |
151 | <!--[if IE]><script type="text/javascript" src="/static/excanvas.js"></script><![endif]--> |
|
151 | <!--[if IE]><script type="text/javascript" src="/static/excanvas.js"></script><![endif]--> | |
152 | </head> |
|
152 | </head> | |
153 | <body> |
|
153 | <body> | |
154 |
|
154 | |||
155 | <div class="container"> |
|
155 | <div class="container"> | |
156 | <div class="menu"> |
|
156 | <div class="menu"> | |
157 | <div class="logo"> |
|
157 | <div class="logo"> | |
158 | <a href="http://www.selenic.com/mercurial/"> |
|
158 | <a href="http://www.selenic.com/mercurial/"> | |
159 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
159 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
160 | </div> |
|
160 | </div> | |
161 | <ul> |
|
161 | <ul> | |
162 | <li><a href="/shortlog/000000000000">log</a></li> |
|
162 | <li><a href="/shortlog/000000000000">log</a></li> | |
163 | <li class="active">graph</li> |
|
163 | <li class="active">graph</li> | |
164 | <li><a href="/tags">tags</a></li> |
|
164 | <li><a href="/tags">tags</a></li> | |
165 | </ul> |
|
165 | </ul> | |
166 | <ul> |
|
166 | <ul> | |
167 | <li><a href="/rev/000000000000">changeset</a></li> |
|
167 | <li><a href="/rev/000000000000">changeset</a></li> | |
168 | <li><a href="/file/000000000000">browse</a></li> |
|
168 | <li><a href="/file/000000000000">browse</a></li> | |
169 | </ul> |
|
169 | </ul> | |
170 | </div> |
|
170 | </div> | |
171 |
|
171 | |||
172 | <div class="main"> |
|
172 | <div class="main"> | |
173 | <h2><a href="/">test</a></h2> |
|
173 | <h2><a href="/">test</a></h2> | |
174 | <h3>graph</h3> |
|
174 | <h3>graph</h3> | |
175 |
|
175 | |||
176 | <form class="search" action="/log"> |
|
176 | <form class="search" action="/log"> | |
177 |
|
177 | |||
178 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
178 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
179 | <div id="hint">find changesets by author, revision, |
|
179 | <div id="hint">find changesets by author, revision, | |
180 | files, or words in the commit message</div> |
|
180 | files, or words in the commit message</div> | |
181 | </form> |
|
181 | </form> | |
182 |
|
182 | |||
183 | <div class="navigate"> |
|
183 | <div class="navigate"> | |
184 | <a href="/graph/-1?revcount=12">less</a> |
|
184 | <a href="/graph/-1?revcount=12">less</a> | |
185 | <a href="/graph/-1?revcount=50">more</a> |
|
185 | <a href="/graph/-1?revcount=50">more</a> | |
186 | | rev -1: <a href="/graph/000000000000">(0)</a> <a href="/graph/tip">tip</a> |
|
186 | | rev -1: <a href="/graph/000000000000">(0)</a> <a href="/graph/tip">tip</a> | |
187 | </div> |
|
187 | </div> | |
188 |
|
188 | |||
189 | <noscript><p>The revision graph only works with JavaScript-enabled browsers.</p></noscript> |
|
189 | <noscript><p>The revision graph only works with JavaScript-enabled browsers.</p></noscript> | |
190 |
|
190 | |||
191 | <div id="wrapper"> |
|
191 | <div id="wrapper"> | |
192 | <ul id="nodebgs"></ul> |
|
192 | <ul id="nodebgs"></ul> | |
193 | <canvas id="graph" width="224" height="12"></canvas> |
|
193 | <canvas id="graph" width="224" height="12"></canvas> | |
194 | <ul id="graphnodes"></ul> |
|
194 | <ul id="graphnodes"></ul> | |
195 | </div> |
|
195 | </div> | |
196 |
|
196 | |||
197 | <script type="text/javascript" src="/static/graph.js"></script> |
|
197 | <script type="text/javascript" src="/static/graph.js"></script> | |
198 | <script type="text/javascript"> |
|
198 | <script type="text/javascript"> | |
199 | <!-- hide script content |
|
199 | <!-- hide script content | |
200 |
|
200 | |||
201 | var data = []; |
|
201 | var data = []; | |
202 | var graph = new Graph(); |
|
202 | var graph = new Graph(); | |
203 | graph.scale(39); |
|
203 | graph.scale(39); | |
204 |
|
204 | |||
205 | graph.edge = function(x0, y0, x1, y1, color) { |
|
205 | graph.edge = function(x0, y0, x1, y1, color) { | |
206 |
|
206 | |||
207 | this.setColor(color, 0.0, 0.65); |
|
207 | this.setColor(color, 0.0, 0.65); | |
208 | this.ctx.beginPath(); |
|
208 | this.ctx.beginPath(); | |
209 | this.ctx.moveTo(x0, y0); |
|
209 | this.ctx.moveTo(x0, y0); | |
210 | this.ctx.lineTo(x1, y1); |
|
210 | this.ctx.lineTo(x1, y1); | |
211 | this.ctx.stroke(); |
|
211 | this.ctx.stroke(); | |
212 |
|
212 | |||
213 | } |
|
213 | } | |
214 |
|
214 | |||
215 | var revlink = '<li style="_STYLE"><span class="desc">'; |
|
215 | var revlink = '<li style="_STYLE"><span class="desc">'; | |
216 | revlink += '<a href="/rev/_NODEID" title="_NODEID">_DESC</a>'; |
|
216 | revlink += '<a href="/rev/_NODEID" title="_NODEID">_DESC</a>'; | |
217 | revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>'; |
|
217 | revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>'; | |
218 |
|
218 | |||
219 | graph.vertex = function(x, y, color, parity, cur) { |
|
219 | graph.vertex = function(x, y, color, parity, cur) { | |
220 |
|
220 | |||
221 | this.ctx.beginPath(); |
|
221 | this.ctx.beginPath(); | |
222 | color = this.setColor(color, 0.25, 0.75); |
|
222 | color = this.setColor(color, 0.25, 0.75); | |
223 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); |
|
223 | this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); | |
224 | this.ctx.fill(); |
|
224 | this.ctx.fill(); | |
225 |
|
225 | |||
226 | var bg = '<li class="bg parity' + parity + '"></li>'; |
|
226 | var bg = '<li class="bg parity' + parity + '"></li>'; | |
227 | var left = (this.columns + 1) * this.bg_height; |
|
227 | var left = (this.columns + 1) * this.bg_height; | |
228 | var nstyle = 'padding-left: ' + left + 'px;'; |
|
228 | var nstyle = 'padding-left: ' + left + 'px;'; | |
229 | var item = revlink.replace(/_STYLE/, nstyle); |
|
229 | var item = revlink.replace(/_STYLE/, nstyle); | |
230 | item = item.replace(/_PARITY/, 'parity' + parity); |
|
230 | item = item.replace(/_PARITY/, 'parity' + parity); | |
231 | item = item.replace(/_NODEID/, cur[0]); |
|
231 | item = item.replace(/_NODEID/, cur[0]); | |
232 | item = item.replace(/_NODEID/, cur[0]); |
|
232 | item = item.replace(/_NODEID/, cur[0]); | |
233 | if (cur[3] != '') |
|
233 | item = item.replace(/_DESC/, cur[3]); | |
234 | item = item.replace(/_DESC/, cur[3]); |
|
|||
235 | else |
|
|||
236 | item = item.replace(/_DESC/, '(none)'); |
|
|||
237 | item = item.replace(/_USER/, cur[4]); |
|
234 | item = item.replace(/_USER/, cur[4]); | |
238 | item = item.replace(/_DATE/, cur[5]); |
|
235 | item = item.replace(/_DATE/, cur[5]); | |
239 |
|
236 | |||
240 | var tagspan = ''; |
|
237 | var tagspan = ''; | |
241 | if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { |
|
238 | if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { | |
242 | tagspan = '<span class="logtags">'; |
|
239 | tagspan = '<span class="logtags">'; | |
243 | if (cur[6][1]) { |
|
240 | if (cur[6][1]) { | |
244 | tagspan += '<span class="branchhead" title="' + cur[6][0] + '">'; |
|
241 | tagspan += '<span class="branchhead" title="' + cur[6][0] + '">'; | |
245 | tagspan += cur[6][0] + '</span> '; |
|
242 | tagspan += cur[6][0] + '</span> '; | |
246 | } else if (!cur[6][1] && cur[6][0] != 'default') { |
|
243 | } else if (!cur[6][1] && cur[6][0] != 'default') { | |
247 | tagspan += '<span class="branchname" title="' + cur[6][0] + '">'; |
|
244 | tagspan += '<span class="branchname" title="' + cur[6][0] + '">'; | |
248 | tagspan += cur[6][0] + '</span> '; |
|
245 | tagspan += cur[6][0] + '</span> '; | |
249 | } |
|
246 | } | |
250 | if (cur[7].length) { |
|
247 | if (cur[7].length) { | |
251 | for (var t in cur[7]) { |
|
248 | for (var t in cur[7]) { | |
252 | var tag = cur[7][t]; |
|
249 | var tag = cur[7][t]; | |
253 | tagspan += '<span class="tag">' + tag + '</span> '; |
|
250 | tagspan += '<span class="tag">' + tag + '</span> '; | |
254 | } |
|
251 | } | |
255 | } |
|
252 | } | |
256 | tagspan += '</span>'; |
|
253 | tagspan += '</span>'; | |
257 | } |
|
254 | } | |
258 |
|
255 | |||
259 | item = item.replace(/_TAGS/, tagspan); |
|
256 | item = item.replace(/_TAGS/, tagspan); | |
260 | return [bg, item]; |
|
257 | return [bg, item]; | |
261 |
|
258 | |||
262 | } |
|
259 | } | |
263 |
|
260 | |||
264 | graph.render(data); |
|
261 | graph.render(data); | |
265 |
|
262 | |||
266 | // stop hiding script --> |
|
263 | // stop hiding script --> | |
267 | </script> |
|
264 | </script> | |
268 |
|
265 | |||
269 | <div class="navigate"> |
|
266 | <div class="navigate"> | |
270 | <a href="/graph/-1?revcount=12">less</a> |
|
267 | <a href="/graph/-1?revcount=12">less</a> | |
271 | <a href="/graph/-1?revcount=50">more</a> |
|
268 | <a href="/graph/-1?revcount=50">more</a> | |
272 | | rev -1: <a href="/graph/000000000000">(0)</a> <a href="/graph/tip">tip</a> |
|
269 | | rev -1: <a href="/graph/000000000000">(0)</a> <a href="/graph/tip">tip</a> | |
273 | </div> |
|
270 | </div> | |
274 |
|
271 | |||
275 | </div> |
|
272 | </div> | |
276 | </div> |
|
273 | </div> | |
277 |
|
274 | |||
278 |
|
275 | |||
279 |
|
276 | |||
280 | </body> |
|
277 | </body> | |
281 | </html> |
|
278 | </html> | |
282 |
|
279 | |||
283 | 200 Script output follows |
|
280 | 200 Script output follows | |
284 |
|
281 | |||
285 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
282 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
286 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
283 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
287 | <head> |
|
284 | <head> | |
288 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
285 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
289 | <meta name="robots" content="index, nofollow" /> |
|
286 | <meta name="robots" content="index, nofollow" /> | |
290 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
287 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
291 |
|
288 | |||
292 | <title>test: 000000000000 /</title> |
|
289 | <title>test: 000000000000 /</title> | |
293 | </head> |
|
290 | </head> | |
294 | <body> |
|
291 | <body> | |
295 |
|
292 | |||
296 | <div class="container"> |
|
293 | <div class="container"> | |
297 | <div class="menu"> |
|
294 | <div class="menu"> | |
298 | <div class="logo"> |
|
295 | <div class="logo"> | |
299 | <a href="http://www.selenic.com/mercurial/"> |
|
296 | <a href="http://www.selenic.com/mercurial/"> | |
300 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
297 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
301 | </div> |
|
298 | </div> | |
302 | <ul> |
|
299 | <ul> | |
303 | <li><a href="/shortlog/000000000000">log</a></li> |
|
300 | <li><a href="/shortlog/000000000000">log</a></li> | |
304 | <li><a href="/graph/000000000000">graph</a></li> |
|
301 | <li><a href="/graph/000000000000">graph</a></li> | |
305 | <li><a href="/tags">tags</a></li> |
|
302 | <li><a href="/tags">tags</a></li> | |
306 | </ul> |
|
303 | </ul> | |
307 | <ul> |
|
304 | <ul> | |
308 | <li><a href="/rev/000000000000">changeset</a></li> |
|
305 | <li><a href="/rev/000000000000">changeset</a></li> | |
309 | <li class="active">browse</li> |
|
306 | <li class="active">browse</li> | |
310 | </ul> |
|
307 | </ul> | |
311 | <ul> |
|
308 | <ul> | |
312 |
|
309 | |||
313 | </ul> |
|
310 | </ul> | |
314 | </div> |
|
311 | </div> | |
315 |
|
312 | |||
316 | <div class="main"> |
|
313 | <div class="main"> | |
317 | <h2><a href="/">test</a></h2> |
|
314 | <h2><a href="/">test</a></h2> | |
318 | <h3>directory / @ -1:000000000000 <span class="tag">tip</span> </h3> |
|
315 | <h3>directory / @ -1:000000000000 <span class="tag">tip</span> </h3> | |
319 |
|
316 | |||
320 | <form class="search" action="/log"> |
|
317 | <form class="search" action="/log"> | |
321 |
|
318 | |||
322 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
319 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
323 | <div id="hint">find changesets by author, revision, |
|
320 | <div id="hint">find changesets by author, revision, | |
324 | files, or words in the commit message</div> |
|
321 | files, or words in the commit message</div> | |
325 | </form> |
|
322 | </form> | |
326 |
|
323 | |||
327 | <table class="bigtable"> |
|
324 | <table class="bigtable"> | |
328 | <tr> |
|
325 | <tr> | |
329 | <th class="name">name</th> |
|
326 | <th class="name">name</th> | |
330 | <th class="size">size</th> |
|
327 | <th class="size">size</th> | |
331 | <th class="permissions">permissions</th> |
|
328 | <th class="permissions">permissions</th> | |
332 | </tr> |
|
329 | </tr> | |
333 | <tr class="fileline parity0"> |
|
330 | <tr class="fileline parity0"> | |
334 | <td class="name"><a href="/file/000000000000/">[up]</a></td> |
|
331 | <td class="name"><a href="/file/000000000000/">[up]</a></td> | |
335 | <td class="size"></td> |
|
332 | <td class="size"></td> | |
336 | <td class="permissions">drwxr-xr-x</td> |
|
333 | <td class="permissions">drwxr-xr-x</td> | |
337 | </tr> |
|
334 | </tr> | |
338 |
|
335 | |||
339 |
|
336 | |||
340 | </table> |
|
337 | </table> | |
341 | </div> |
|
338 | </div> | |
342 | </div> |
|
339 | </div> | |
343 |
|
340 | |||
344 |
|
341 | |||
345 | </body> |
|
342 | </body> | |
346 | </html> |
|
343 | </html> | |
347 |
|
344 |
General Comments 0
You need to be logged in to leave comments.
Login now