##// END OF EJS Templates
merge with crew-stable
Alexis S. L. Carvalho -
r4081:e6d26e71 merge default
parent child Browse files
Show More
@@ -240,7 +240,9 b' class notifier(object):'
240 240 difflines = self.ui.popbuffer().splitlines(1)
241 241 if self.ui.configbool('notify', 'diffstat', True):
242 242 s = patch.diffstat(difflines)
243 self.ui.write('\ndiffstat:\n\n' + s)
243 # s may be nil, don't include the header if it is
244 if s:
245 self.ui.write('\ndiffstat:\n\n%s' % s)
244 246 if maxdiff > 0 and len(difflines) > maxdiff:
245 247 self.ui.write(_('\ndiffs (truncated from %d to %d lines):\n\n') %
246 248 (len(difflines), maxdiff))
@@ -2298,11 +2298,12 b' def serve(ui, repo, **opts):'
2298 2298 s = sshserver.sshserver(ui, repo)
2299 2299 s.serve_forever()
2300 2300
2301 parentui = ui.parentui or ui
2301 2302 optlist = ("name templates style address port ipv6"
2302 2303 " accesslog errorlog webdir_conf")
2303 2304 for o in optlist.split():
2304 2305 if opts[o]:
2305 ui.setconfig("web", o, str(opts[o]))
2306 parentui.setconfig("web", o, str(opts[o]))
2306 2307
2307 2308 if repo is None and not ui.config("web", "webdir_conf"):
2308 2309 raise hg.RepoError(_("There is no Mercurial repository here"
@@ -2318,7 +2319,7 b' def serve(ui, repo, **opts):'
2318 2319 os.read(rfd, 1)
2319 2320 os._exit(0)
2320 2321
2321 httpd = hgweb.server.create_server(ui, repo)
2322 httpd = hgweb.server.create_server(parentui, repo)
2322 2323
2323 2324 if ui.verbose:
2324 2325 if httpd.port != 80:
@@ -389,7 +389,7 b' class dirstate(object):'
389 389
390 390 # self.root may end with a path separator when self.root == '/'
391 391 common_prefix_len = len(self.root)
392 if not self.root.endswith('/'):
392 if not self.root.endswith(os.sep):
393 393 common_prefix_len += 1
394 394 # recursion free walker, faster than os.walk.
395 395 def findfiles(s):
@@ -55,6 +55,7 b' repo_setup_hooks = []'
55 55 def repository(ui, path='', create=False):
56 56 """return a repository object for the specified path"""
57 57 repo = _lookup(path).instance(ui, path, create)
58 ui = getattr(repo, "ui", ui)
58 59 for hook in repo_setup_hooks:
59 60 hook(ui, repo)
60 61 return repo
@@ -15,12 +15,13 b' from hgweb_mod import hgweb'
15 15
16 16 # This is a stopgap
17 17 class hgwebdir(object):
18 def __init__(self, config):
18 def __init__(self, config, parentui=None):
19 19 def cleannames(items):
20 20 return [(name.strip(os.sep), path) for name, path in items]
21 21
22 self.motd = ""
23 self.style = ""
22 self.parentui = parentui
23 self.motd = None
24 self.style = None
24 25 self.repos_sorted = ('name', False)
25 26 if isinstance(config, (list, tuple)):
26 27 self.repos = cleannames(config)
@@ -73,13 +74,23 b' class hgwebdir(object):'
73 74 yield tmpl("footer", **map)
74 75
75 76 def motd(**map):
76 yield self.motd
77 if self.motd is not None:
78 yield self.motd
79 else:
80 yield config('web', 'motd', '')
81
82 parentui = self.parentui or ui.ui(report_untrusted=False)
83
84 def config(section, name, default=None, untrusted=True):
85 return parentui.config(section, name, default, untrusted)
77 86
78 87 url = req.env['REQUEST_URI'].split('?')[0]
79 88 if not url.endswith('/'):
80 89 url += '/'
81 90
82 91 style = self.style
92 if style is None:
93 style = config('web', 'style', '')
83 94 if req.form.has_key('style'):
84 95 style = req.form['style'][0]
85 96 mapfile = style_map(templater.templatepath(), style)
@@ -113,7 +124,7 b' class hgwebdir(object):'
113 124 rows = []
114 125 parity = 0
115 126 for name, path in self.repos:
116 u = ui.ui(report_untrusted=False)
127 u = ui.ui(parentui=parentui)
117 128 try:
118 129 u.readconfig(os.path.join(path, '.hg', 'hgrc'))
119 130 except IOError:
@@ -181,7 +192,8 b' class hgwebdir(object):'
181 192 if real:
182 193 req.env['REPO_NAME'] = virtual
183 194 try:
184 hgweb(real).run_wsgi(req)
195 repo = hg.repository(parentui, real)
196 hgweb(repo).run_wsgi(req)
185 197 except IOError, inst:
186 198 req.write(tmpl("error", error=inst.strerror))
187 199 except hg.RepoError, inst:
@@ -220,7 +220,7 b' def create_server(ui, repo):'
220 220
221 221 def make_handler(self):
222 222 if self.webdir_conf:
223 hgwebobj = self.webdirmaker(self.webdir_conf)
223 hgwebobj = self.webdirmaker(self.webdir_conf, ui)
224 224 elif self.repo is not None:
225 225 hgwebobj = self.repoviewmaker(repo.__class__(repo.ui,
226 226 repo.origroot))
@@ -9,8 +9,10 b''
9 9 # http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side
10 10
11 11 import os, sys
12 from mercurial import util
12 13
13 14 def launch(application):
15 util.set_binary(sys.stdout)
14 16
15 17 environ = dict(os.environ.items())
16 18 environ['wsgi.input'] = sys.stdin
@@ -7,9 +7,12 b' from mercurial import commands'
7 7
8 8 def uisetup(ui):
9 9 ui.write("uisetup called\\n")
10 ui.write("ui.parentui is%s None\\n" % (ui.parentui is not None
11 and "not" or ""))
10 12
11 13 def reposetup(ui, repo):
12 14 ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
15 ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
13 16
14 17 def foo(ui, *args, **kwargs):
15 18 ui.write("Foo\\n")
@@ -1,9 +1,15 b''
1 1 uisetup called
2 ui.parentui is None
2 3 reposetup called for a
4 ui == repo.ui
3 5 Foo
4 6 uisetup called
7 ui.parentui is None
5 8 reposetup called for a
9 ui == repo.ui
6 10 reposetup called for b
11 ui == repo.ui
7 12 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
8 13 uisetup called
14 ui.parentui is None
9 15 Bar
General Comments 0
You need to be logged in to leave comments. Login now