Skip to content

transport: convert Dulwich host name to unicode

This fixes cloning using the old git protocol, which currently fails like this:

$ hg clone git://github.com/hg-git/nonexistent
destination directory: nonexistent
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.8.6 (default, Sep 28 2020, 04:41:02) [Clang 11.0.3 (clang-1103.0.32.62)]
** Mercurial Distributed SCM (version 5.5.2)
** Extensions loaded: evolve, beautifygraph, mpush, absorb, histedit, graphlog, share, record, highlight, children, pager, extdiff, purge, rebase, hggit, strip, topic
Traceback (most recent call last):
  File "$BINDIR/hg", line 43, in <module>
    dispatch.run()
  File "$PKGDIR/mercurial/dispatch.py", line 113, in run
    status = dispatch(req)
  File "$PKGDIR/mercurial/dispatch.py", line 303, in dispatch
    ret = _runcatch(req) or 0
  File "$PKGDIR/mercurial/dispatch.py", line 479, in _runcatch
    return _callcatch(ui, _runcatchfunc)
  File "$PKGDIR/mercurial/dispatch.py", line 488, in _callcatch
    return scmutil.callcatch(ui, func)
  File "$PKGDIR/mercurial/scmutil.py", line 152, in callcatch
    return func()
  File "$PKGDIR/mercurial/dispatch.py", line 469, in _runcatchfunc
    return _dispatch(req)
  File "$PKGDIR/mercurial/dispatch.py", line 1232, in _dispatch
    return runcommand(
  File "$PKGDIR/mercurial/dispatch.py", line 917, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "$PKGDIR/hgext/pager.py", line 76, in pagecmd
    return orig(ui, options, cmd, cmdfunc)
  File "$PKGDIR/mercurial/dispatch.py", line 1244, in _runcommand
    return cmdfunc()
  File "$PKGDIR/mercurial/dispatch.py", line 1230, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "$PKGDIR/mercurial/util.py", line 1867, in check
    return func(*args, **kwargs)
  File "$PKGDIR/mercurial/util.py", line 1867, in check
    return func(*args, **kwargs)
  File "$PKGDIR/hgext/share.py", line 139, in clone
    return orig(ui, source, *args, **opts)
  File "$PKGDIR/mercurial/util.py", line 1867, in check
    return func(*args, **kwargs)
  File "$PKGDIR/mercurial/commands.py", line 1904, in clone
    r = hg.clone(
  File "$PKGDIR/mercurial/hg.py", line 901, in clone
    exchange.pull(
  File "$HGROOT/hggit/util.py", line 64, in inner
    return f(*args, **kwargs)
  File "$HGROOT/hggit/__init__.py", line 431, in exchangepull
    pullop.cgresult = repo.githandler.fetch(remote.path, heads)
  File "$HGROOT/hggit/git_handler.py", line 286, in fetch
    result = self.fetch_pack(remote, heads)
  File "$HGROOT/hggit/git_handler.py", line 1265, in fetch_pack
    ret = localclient.fetch_pack(path, determine_wants, graphwalker,
  File "$PKGDIR/dulwich/client.py", line 909, in fetch_pack
    proto, can_read, stderr = self._connect(b'upload-pack', path)
  File "$PKGDIR/dulwich/client.py", line 1048, in _connect
    b'git-' + cmd, path, b'host=' + self._host.encode('ascii'))
AttributeError: 'bytes' object has no attribute 'encode'
Edited by Dan Villiom Podlaski Christiansen

Merge request reports