comparison contrib/hg-ssh @ 38107:44ef9bb7ccd9

py3: add b'' prefixes in contrib/hg-ssh # skip-blame because just b'' prefixes Differential Revision: https://phab.mercurial-scm.org/D3629
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 20 May 2018 17:33:18 +0530
parents dc1ed7fe33e4
children 666d90ace0bb
comparison
equal deleted inserted replaced
38106:a0e4d654bceb 38107:44ef9bb7ccd9
67 67
68 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']: 68 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']:
69 path = cmdargv[2] 69 path = cmdargv[2]
70 repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) 70 repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path)))
71 if repo in allowed_paths: 71 if repo in allowed_paths:
72 cmd = ['-R', repo, 'serve', '--stdio'] 72 cmd = [b'-R', repo, b'serve', b'--stdio']
73 req = dispatch.request(cmd) 73 req = dispatch.request(cmd)
74 if readonly: 74 if readonly:
75 if not req.ui: 75 if not req.ui:
76 req.ui = uimod.ui.load() 76 req.ui = uimod.ui.load()
77 req.ui.setconfig('hooks', 'pretxnopen.hg-ssh', 77 req.ui.setconfig(b'hooks', b'pretxnopen.hg-ssh',
78 'python:__main__.rejectpush', 'hg-ssh') 78 b'python:__main__.rejectpush', b'hg-ssh')
79 req.ui.setconfig('hooks', 'prepushkey.hg-ssh', 79 req.ui.setconfig(b'hooks', b'prepushkey.hg-ssh',
80 'python:__main__.rejectpush', 'hg-ssh') 80 b'python:__main__.rejectpush', b'hg-ssh')
81 dispatch.dispatch(req) 81 dispatch.dispatch(req)
82 else: 82 else:
83 sys.stderr.write('Illegal repository "%s"\n' % repo) 83 sys.stderr.write('Illegal repository "%s"\n' % repo)
84 sys.exit(255) 84 sys.exit(255)
85 else: 85 else:
86 sys.stderr.write('Illegal command "%s"\n' % orig_cmd) 86 sys.stderr.write('Illegal command "%s"\n' % orig_cmd)
87 sys.exit(255) 87 sys.exit(255)
88 88
89 def rejectpush(ui, **kwargs): 89 def rejectpush(ui, **kwargs):
90 ui.warn(("Permission denied\n")) 90 ui.warn((b"Permission denied\n"))
91 # mercurial hooks use unix process conventions for hook return values 91 # mercurial hooks use unix process conventions for hook return values
92 # so a truthy return means failure 92 # so a truthy return means failure
93 return True 93 return True
94 94
95 if __name__ == '__main__': 95 if __name__ == '__main__':