Mercurial > hg
view tests/test-sshserver.py @ 49779:7d6c8943353a stable
hg: show the correct message when cloning an LFS repo with extension disabled
The `extensions._disabledpaths()` doesn't handle fetching help from `__index__`,
so it returns an empty dictionary of paths. That means None is always returned
from `extensions.disabled_help()` when embedding resources inside the pyoxidizer
or py2exe binary, regardless of the arg or if is an external extension stored in
the filesystem. And that means wrongly telling the user with an explicitly
disabled LFS extension that it will be enabled locally upon cloning from an LFS
remote. That causes test-lfs-serve.t:295 to fail.
This effectively reverts most of the rest of 843418dc0b1b, while keeping the
help text change in place (which was specifically identified as a problem).
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 05 Dec 2022 15:14:33 -0500 |
parents | 642e31cb55f0 |
children | 13c004b54cbe |
line wrap: on
line source
import io import unittest import silenttestrunner from mercurial import ( wireprotoserver, wireprotov1server, ) from mercurial.utils import procutil class SSHServerGetArgsTests(unittest.TestCase): def testparseknown(self): tests = [ (b'* 0\nnodes 0\n', [b'', {}]), ( b'* 0\nnodes 40\n1111111111111111111111111111111111111111\n', [b'1111111111111111111111111111111111111111', {}], ), ] for input, expected in tests: self.assertparse(b'known', input, expected) def assertparse(self, cmd, input, expected): server = mockserver(input) proto = wireprotoserver.sshv1protocolhandler( server._ui, server._fin, server._fout ) _func, spec = wireprotov1server.commands[cmd] self.assertEqual(proto.getargs(spec), expected) def mockserver(inbytes): ui = mockui(inbytes) repo = mockrepo(ui) return wireprotoserver.sshserver(ui, repo) class mockrepo: def __init__(self, ui): self.ui = ui class mockui: def __init__(self, inbytes): self.fin = io.BytesIO(inbytes) self.fout = io.BytesIO() self.ferr = io.BytesIO() def protectfinout(self): return self.fin, self.fout def restorefinout(self, fin, fout): pass if __name__ == '__main__': # Don't call into msvcrt to set BytesIO to binary mode procutil.setbinary = lambda fp: True silenttestrunner.main(__name__)