jelmer / dulwich

Pure-Python Git implementation
https://www.dulwich.io/
Other
2.06k stars 395 forks source link

py2 pulling from git https remote miss module brotli #795

Closed alexrayne closed 4 years ago

alexrayne commented 4 years ago

hallow!

try to pull repo with mercurial 5.4 on win8

(use hggit https://foss.heptapod.net/mercurial/hg-git/-/commit/c822fd9af8393ad7652c6b5573b8870f21c98e1b)

got this crash:

D:\projects\contiki.hggit>hg pull --verbose --debug --traceback --force git+https://github.com/bkozak-scanimet
rics/contiki-ng.git
чрЄ уштрхь шч git+https://github.com/bkozak-scanimetrics/contiki-ng.git
http-ртЄюЁшчрЎш  ЄЁхсєхЄё  фы  https://github.com/bkozak-scanimetrics/contiki-ng.git
юсырёЄ№ (realm): None
яюы№чютрЄхы№: alexrayne
ярЁюы№:
http-ртЄюЁшчрЎш : яюы№чютрЄхы№ alexrayne, ярЁюы№ *************
Traceback (most recent call last):
  File "mercurial\scmutil.pyc", line 152, in callcatch
  File "mercurial\dispatch.pyc", line 462, in _runcatchfunc
  File "mercurial\dispatch.pyc", line 1226, in _dispatch
  File "mercurial\dispatch.pyc", line 910, in runcommand
  File "mercurial\dispatch.pyc", line 1237, in _runcommand
  File "mercurial\dispatch.pyc", line 1223, in <lambda>
  File "mercurial\util.pyc", line 1864, in check
  File "mercurial\util.pyc", line 1864, in check
  File "hgext\mq.pyc", line 4218, in mqcommand
  File "mercurial\util.pyc", line 1864, in check
  File "mercurial\util.pyc", line 1864, in check
  File "hgext\narrow\narrowcommands.pyc", line 148, in pullnarrowcmd
  File "mercurial\util.pyc", line 1864, in check
  File "mercurial\util.pyc", line 1864, in check
  File "hgext\rebase.pyc", line 2115, in pullrebase
  File "mercurial\util.pyc", line 1864, in check
  File "mercurial\commands.pyc", line 5463, in pull
  File "mercurial\extensions.pyc", line 509, in closure
  File "D:/projects/hg/hg-git\hggit\util.py", line 64, in inner
  File "D:/projects/hg/hg-git\hggit\__init__.py", line 368, in exchangepull
  File "D:/projects/hg/hg-git\hggit\git_handler.py", line 283, in fetch
  File "D:/projects/hg/hg-git\hggit\git_handler.py", line 1202, in fetch_pack
  File "D:/projects/hg/hg-git\hggit\git_handler.py", line 1764, in get_transport_and_path
  File "dulwich\client.pyc", line 1433, in __init__
  File "dulwich\client.pyc", line 1408, in default_urllib3_manager
  File "hgdemandimport\demandimportpy2.pyc", line 181, in _demandimport
  File "hgdemandimport\demandimportpy2.pyc", line 44, in _hgextimport
  File "urllib3\__init__.pyc", line 7, in <module>
  File "hgdemandimport\demandimportpy2.pyc", line 257, in _demandimport
  File "hgdemandimport\demandimportpy2.pyc", line 44, in _hgextimport
  File "urllib3\connectionpool.pyc", line 39, in <module>
  File "hgdemandimport\demandimportpy2.pyc", line 257, in _demandimport
  File "hgdemandimport\demandimportpy2.pyc", line 44, in _hgextimport
  File "urllib3\response.pyc", line 155, in <module>
  File "urllib3\response.pyc", line 377, in HTTPResponse
  File "hgdemandimport\demandimportpy2.pyc", line 157, in __getattr__
  File "hgdemandimport\demandimportpy2.pyc", line 97, in _load
  File "hgdemandimport\demandimportpy2.pyc", line 44, in _hgextimport
ImportError: No module named brotli
яЁхЁтрэю: No module named brotli!
jelmer commented 4 years ago

This is an interaction between mercurial's demandimport and urllib3 probing for brotli; urllib3 assumes that "import brotli" succeeding means the package is present. I don't see how dulwich is involved, other than depending on urllib3.

I think this warrants a fix in either mercurial (since it overrides the behaviour of standard import) or you could possibly do a workaround in urllib3.