def localpeer(ui, path): ui.setconfig(b'ui', b'ssh', b'') has_checksafessh = hasattr(util, 'checksafessh') sshargs = procutil.sshargs shellquote = procutil.shellquote quotecommand = getattr(procutil, 'quotecommand', None) url = util.url if has_checksafessh: checksafessh = util.checksafessh procutil.sshargs = lambda *a: b'' procutil.shellquote = lambda x: x if has_checksafessh: util.checksafessh = lambda x: None # In very old versions of mercurial, shellquote was not used, and # double quotes were hardcoded. Remove them by overriding # quotecommand. def override_quotecommand(cmd): cmd = cmd.lstrip() if cmd.startswith(b'"'): cmd = cmd[1:-1] return quotecommand(cmd) if quotecommand: procutil.quotecommand = override_quotecommand class override_url(object): def __init__(self, *args, **kwargs): self.scheme = b'ssh' self.host = b'localhost' self.port = None self.path = path self.user = b'user' self.passwd = None util.url = override_url repo = sshpeer(ui, path, False) if has_checksafessh: util.checksafessh = checksafessh util.url = url if quotecommand: procutil.quotecommand = quotecommand procutil.shellquote = shellquote procutil.sshargs = sshargs return repo
def localpeer(ui, path): ui.setconfig('ui', 'ssh', '') has_checksafessh = hasattr(util, 'checksafessh') sshargs = procutil.sshargs shellquote = procutil.shellquote quotecommand = procutil.quotecommand url = util.url if has_checksafessh: checksafessh = util.checksafessh procutil.sshargs = lambda *a: '' procutil.shellquote = lambda x: x if has_checksafessh: util.checksafessh = lambda x: None # In very old versions of mercurial, shellquote was not used, and # double quotes were hardcoded. Remove them by overriding # quotecommand. def override_quotecommand(cmd): cmd = cmd.lstrip() if cmd.startswith('"'): cmd = cmd[1:-1] return quotecommand(cmd) procutil.quotecommand = override_quotecommand class override_url(object): def __init__(self, *args, **kwargs): self.scheme = 'ssh' self.host = 'localhost' self.port = None self.path = path self.user = '******' self.passwd = None util.url = override_url repo = sshpeer(ui, path, False) if has_checksafessh: util.checksafessh = checksafessh util.url = url procutil.quotecommand = quotecommand procutil.shellquote = shellquote procutil.sshargs = sshargs return repo