Patchwork D10177: merge: force an exception message to bytes before printing as a warning

login
register
mail settings
Submitter phabricator
Date March 12, 2021, 6:09 p.m.
Message ID <differential-rev-PHID-DREV-iegzywrmos6c6dvr5aai-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48490/
State Superseded
Headers show

Comments

phabricator - March 12, 2021, 6:09 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Caught by pytype:
  
    File "/mnt/c/Users/Matt/hg/mercurial/merge.py", line 1346, in batchremove: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
             Expected: (self, ints: Iterable[int])
      Actually passed: (self, ints: str)

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10177

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -20,6 +20,7 @@ 
     nullrev,
 )
 from .thirdparty import attr
+from .utils import stringutil
 from . import (
     copies,
     encoding,
@@ -1341,7 +1342,7 @@ 
         except OSError as inst:
             repo.ui.warn(
                 _(b"update failed to remove %s: %s!\n")
-                % (f, pycompat.bytestr(inst.strerror))
+                % (f, stringutil.forcebytestr(inst.strerror))
             )
         if i == 100:
             yield i, f