https://bz.mercurial-scm.org/show_bug.cgi?id=6840

            Bug ID: 6840
           Summary: hg import a file fails for encoding
           Product: Mercurial
           Version: 6.5.1
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzi...@mercurial-scm.org
          Reporter: cedric.kr...@b2ck.com
                CC: mercurial-de...@mercurial-scm.org
    Python Version: ---

Here is the traceback:

$ hg import --no-commit /tmp/patch                                              
applying /tmp/patch                                                             
** unknown exception encountered, please report by visiting                     
** https://mercurial-scm.org/wiki/BugTracker                                    
** Python 3.11.4 (main, Jun 24 2023, 08:36:23) [GCC 12.2.1 20230428]            
** Mercurial Distributed SCM (version 6.5.1)                                    
** Extensions loaded: absorb, churn, convert, evolve 11.0.2, histedit, rebase,
relink, share, topic 1.0.2                                                      
Traceback (most recent call last):                                              
  File "/usr/lib/python3.11/site-packages/mercurial/commandserver.py", line
491, in _serverequest                                                           
    sv.serve()                                                                  
  File "/usr/lib/python3.11/site-packages/mercurial/commandserver.py", line
395, in serve                                                                   
    while self.serveone():                                                      
          ^^^^^^^^^^^^^^^                                                       
  File "/usr/lib/python3.11/site-packages/mercurial/commandserver.py", line
369, in serveone                                                                
    handler(self)                                                               
  File "/usr/lib/python3.11/site-packages/mercurial/chgserver.py", line 574, in
runcommand                                                                      
    return super(chgcmdserver, self).runcommand()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/commandserver.py", line
350, in runcommand
    ret = self._dispatchcommand(req) & 255
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/commandserver.py", line
289, in _dispatchcommand
    return dispatch.dispatch(req)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 232, in
dispatch
    status = _rundispatch(req)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 276, in
_rundispatch
    ret = _runcatch(req) or 0
          ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 457, in
_runcatch
    return _callcatch(ui, _runcatchfunc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 467, in
_callcatch
    return scmutil.callcatch(ui, func)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/scmutil.py", line 153, in
callcatch
    return func()
           ^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 447, in
_runcatchfunc
    return _dispatch(req)
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 1272, in
_dispatch
    return runcommand(
           ^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 905, in
runcommand
    ret = _runcommand(ui, options, cmd, d)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 1284, in
_runcommand
    return cmdfunc()
           ^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/dispatch.py", line 1270, in
<lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/util.py", line 1881, in
check
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/commands.py", line 4275, in
import_
    with patch.extract(ui, hunk) as patchdata:
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/patch.py", line 225, in
extract
    yield _extract(ui, fileobj, tmpname, tmpfp)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/patch.py", line 252, in
_extract
    b'\n'.join(
  File "/usr/lib/python3.11/site-packages/mercurial/patch.py", line 253, in
<genexpr>
    b': '.join(map(encoding.strtolocal, h)) for h in msg.items()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/encoding.py", line 247, in
unitolocal
    return tolocal(u.encode('utf-8'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mercurial/encoding.py", line 178, in
tolocal
    if isasciistr(s):
       ^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'str'

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to