128 elif node1 is not None and node1 != repo.changectx().node(): |
128 elif node1 is not None and node1 != repo.changectx().node(): |
129 kwtools['templater'].restrict = True |
129 kwtools['templater'].restrict = True |
130 _patch_diff(repo, node1=node1, node2=node2, files=files, match=match, |
130 _patch_diff(repo, node1=node1, node2=node2, files=files, match=match, |
131 fp=fp, changes=changes, opts=opts) |
131 fp=fp, changes=changes, opts=opts) |
132 |
132 |
|
133 # monkeypatching hgweb functions changeset and filediff |
|
134 # actual monkeypatching is done at the bottom of reposetup() |
|
135 |
|
136 web_changeset = webcommands.changeset |
|
137 web_filediff = webcommands.filediff |
|
138 |
133 def _kwweb_changeset(web, req, tmpl): |
139 def _kwweb_changeset(web, req, tmpl): |
134 '''Wraps webcommands.changeset turning off keyword expansion.''' |
140 '''Wraps webcommands.changeset turning off keyword expansion.''' |
135 kwtools['templater'].matcher = util.never |
141 kwtools['templater'].matcher = util.never |
136 return web.changeset(tmpl, web.changectx(req)) |
142 return web_changeset(web, req, tmpl) |
137 |
143 |
138 def _kwweb_filediff(web, req, tmpl): |
144 def _kwweb_filediff(web, req, tmpl): |
139 '''Wraps webcommands.filediff turning off keyword expansion.''' |
145 '''Wraps webcommands.filediff turning off keyword expansion.''' |
140 kwtools['templater'].matcher = util.never |
146 kwtools['templater'].matcher = util.never |
141 return web.filediff(tmpl, web.filectx(req)) |
147 return web_filediff(web, req, tmpl) |
142 |
148 |
143 def _kwdispatch_parse(ui, args): |
149 def _kwdispatch_parse(ui, args): |
144 '''Monkeypatch dispatch._parse to obtain running hg command.''' |
150 '''Monkeypatch dispatch._parse to obtain running hg command.''' |
145 cmd, func, args, options, cmdoptions = _dispatch_parse(ui, args) |
151 cmd, func, args, options, cmdoptions = _dispatch_parse(ui, args) |
146 kwtools['hgcmd'] = cmd |
152 kwtools['hgcmd'] = cmd |