[Bug 6647] New: unknown exception caused by IsADirectoryError: when doing mv

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Wed Feb 16 12:10:40 UTC 2022


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

            Bug ID: 6647
           Summary: unknown exception caused by IsADirectoryError: when
                    doing mv
           Product: Mercurial
           Version: 5.6.1
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: chris at isbd.co.uk
                CC: mercurial-devel at mercurial-scm.org
    Python Version: ---

I got this exception when I had what should have been a file that became a
directory (caused by me trying to do things too fast across two synchronised
file systems).  

chris at esprimo$ hg rm hosts/pi/bin
abort: Is a directory: '/home/chris/.cfg/hosts/pi/bin'
chris at esprimo$ hg status
R hosts/backup/etc/dhcpcd.conf
! hosts/pi/bin
? bin/switchDns
? hosts/pi/README.txt
? hosts/pi/bin.sync-conflict-20220216-163910-ZGBSAI4
? hosts/pi/bin.sync-conflict-20220216-163912-ZGBSAI4
chris at esprimo$ hg mv hosts/pi/bin hosts/pi/fred
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.9.7 (default, Sep 10 2021, 14:59:43) [GCC 11.2.0]
** Mercurial Distributed SCM (version 5.6.1)
** Extensions loaded: convert
Traceback (most recent call last):
  File "/usr/lib/python3.9/shutil.py", line 265, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
IsADirectoryError: [Errno 21] Is a directory: b'/home/chris/.cfg/hosts/pi/bin'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mercurial/cmdutil.py", line 1686, in
copyfile
    util.copyfile(src, target, copystat=rename)
  File "/usr/lib/python3/dist-packages/mercurial/util.py", line 1931, in
copyfile
    shutil.copyfile(src, dest)
  File "/usr/lib/python3.9/shutil.py", line 293, in copyfile
    raise FileNotFoundError(f'Directory does not exist: {dst}') from e
FileNotFoundError: Directory does not exist: b'/home/chris/.cfg/hosts/pi/fred'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/hg", line 43, in <module>
    dispatch.run()
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 113, in run
    status = dispatch(req)
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 303, in
dispatch
    ret = _runcatch(req) or 0
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 479, in
_runcatch
    return _callcatch(ui, _runcatchfunc)
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 488, in
_callcatch
    return scmutil.callcatch(ui, func)
  File "/usr/lib/python3/dist-packages/mercurial/scmutil.py", line 153, in
callcatch
    return func()
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 469, in
_runcatchfunc
    return _dispatch(req)
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1232, in
_dispatch
    return runcommand(
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 917, in
runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1244, in
_runcommand
    return cmdfunc()
  File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1230, in
<lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/usr/lib/python3/dist-packages/mercurial/util.py", line 1867, in check
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/mercurial/commands.py", line 5692, in
rename
    return cmdutil.copy(ui, repo, pats, opts, rename=True)
  File "/usr/lib/python3/dist-packages/mercurial/cmdutil.py", line 1812, in
copy
    if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
  File "/usr/lib/python3/dist-packages/mercurial/cmdutil.py", line 1695, in
copyfile
    % (relsrc, encoding.strtolocal(inst.strerror))
  File "/usr/lib/python3/dist-packages/mercurial/encoding.py", line 248, in
unitolocal
    return tolocal(u.encode('utf-8'))
AttributeError: 'NoneType' object has no attribute 'encode'
chris at esprimo$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list