6 # This software may be used and distributed according to the terms of the |
6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. |
7 # GNU General Public License version 2 or any later version. |
8 |
8 |
9 import contextlib |
9 import contextlib |
10 import os |
10 import os |
11 from mercurial import ui, hg, hook, error, encoding, templater, util, repoview |
11 from mercurial import hg, hook, error, encoding, templater, util, repoview |
|
12 from mercurial import ui as uimod |
12 from mercurial.templatefilters import websub |
13 from mercurial.templatefilters import websub |
13 from common import ErrorResponse, permhooks, caching |
14 from common import ErrorResponse, permhooks, caching |
14 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST |
15 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST |
15 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
16 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
16 from request import wsgirequest |
17 from request import wsgirequest |
193 def __init__(self, repo, name=None, baseui=None): |
194 def __init__(self, repo, name=None, baseui=None): |
194 if isinstance(repo, str): |
195 if isinstance(repo, str): |
195 if baseui: |
196 if baseui: |
196 u = baseui.copy() |
197 u = baseui.copy() |
197 else: |
198 else: |
198 u = ui.ui() |
199 u = uimod.ui() |
199 r = hg.repository(u, repo) |
200 r = hg.repository(u, repo) |
200 else: |
201 else: |
201 # we trust caller to give us a private copy |
202 # we trust caller to give us a private copy |
202 r = repo |
203 r = repo |
203 |
204 |