equal
deleted
inserted
replaced
37 # enable importing on demand to reduce startup time |
37 # enable importing on demand to reduce startup time |
38 import hgdemandimport ; hgdemandimport.enable() |
38 import hgdemandimport ; hgdemandimport.enable() |
39 |
39 |
40 from mercurial import ( |
40 from mercurial import ( |
41 dispatch, |
41 dispatch, |
|
42 pycompat, |
42 ui as uimod, |
43 ui as uimod, |
43 ) |
44 ) |
44 |
45 |
45 def main(): |
46 def main(): |
46 # Prevent insertion/deletion of CRs |
47 # Prevent insertion/deletion of CRs |
67 |
68 |
68 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']: |
69 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']: |
69 path = cmdargv[2] |
70 path = cmdargv[2] |
70 repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) |
71 repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) |
71 if repo in allowed_paths: |
72 if repo in allowed_paths: |
72 cmd = [b'-R', repo, b'serve', b'--stdio'] |
73 cmd = [b'-R', pycompat.fsencode(repo), b'serve', b'--stdio'] |
73 req = dispatch.request(cmd) |
74 req = dispatch.request(cmd) |
74 if readonly: |
75 if readonly: |
75 if not req.ui: |
76 if not req.ui: |
76 req.ui = uimod.ui.load() |
77 req.ui = uimod.ui.load() |
77 req.ui.setconfig(b'hooks', b'pretxnopen.hg-ssh', |
78 req.ui.setconfig(b'hooks', b'pretxnopen.hg-ssh', |