equal
deleted
inserted
replaced
21 'stream_out': 'pull', |
21 'stream_out': 'pull', |
22 'listkeys': 'pull', |
22 'listkeys': 'pull', |
23 'unbundle': 'push', |
23 'unbundle': 'push', |
24 'pushkey': 'push', |
24 'pushkey': 'push', |
25 } |
25 } |
|
26 |
|
27 def makebreadcrumb(url): |
|
28 '''Return a 'URL breadcrumb' list |
|
29 |
|
30 A 'URL breadcrumb' is a list of URL-name pairs, |
|
31 corresponding to each of the path items on a URL. |
|
32 This can be used to create path navigation entries. |
|
33 ''' |
|
34 if url.endswith('/'): |
|
35 url = url[:-1] |
|
36 relpath = url |
|
37 if relpath.startswith('/'): |
|
38 relpath = relpath[1:] |
|
39 |
|
40 breadcrumb = [] |
|
41 urlel = url |
|
42 pathitems = [''] + relpath.split('/') |
|
43 for pathel in reversed(pathitems): |
|
44 if not pathel or not urlel: |
|
45 break |
|
46 breadcrumb.append({'url': urlel, 'name': pathel}) |
|
47 urlel = os.path.dirname(urlel) |
|
48 return reversed(breadcrumb) |
|
49 |
26 |
50 |
27 class hgweb(object): |
51 class hgweb(object): |
28 def __init__(self, repo, name=None, baseui=None): |
52 def __init__(self, repo, name=None, baseui=None): |
29 if isinstance(repo, str): |
53 if isinstance(repo, str): |
30 if baseui: |
54 if baseui: |
283 "urlbase": urlbase, |
307 "urlbase": urlbase, |
284 "repo": self.reponame, |
308 "repo": self.reponame, |
285 "header": header, |
309 "header": header, |
286 "footer": footer, |
310 "footer": footer, |
287 "motd": motd, |
311 "motd": motd, |
288 "sessionvars": sessionvars |
312 "sessionvars": sessionvars, |
|
313 "pathdef": makebreadcrumb(req.url), |
289 }) |
314 }) |
290 return tmpl |
315 return tmpl |
291 |
316 |
292 def archivelist(self, nodeid): |
317 def archivelist(self, nodeid): |
293 allowed = self.configlist("web", "allow_archive") |
318 allowed = self.configlist("web", "allow_archive") |