Patchwork D7211: fsmonitor: normalize Watchman paths to bytes

login
register
mail settings
Submitter phabricator
Date Nov. 4, 2019, 4:27 p.m.
Message ID <0f638a5b4eeb8229a17c9c42e2076dbf@localhost.localdomain>
Download mbox | patch
Permalink /patch/42720/
State Not Applicable
Headers show

Comments

phabricator - Nov. 4, 2019, 4:27 p.m.
Closed by commit rHG2b8be670dcb6: fsmonitor: normalize Watchman paths to bytes (authored by indygreg).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7211?vs=17509&id=17527

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7211/new/

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

AFFECTED FILES
  hgext/fsmonitor/__init__.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py
+++ b/hgext/fsmonitor/__init__.py
@@ -407,8 +407,15 @@ 
     # for name case changes.
     for entry in result[b'files']:
         fname = entry[b'name']
+
+        # Watchman always give us a str. Normalize to bytes on Python 3
+        # using Watchman's encoding, if needed.
+        if not isinstance(fname, bytes):
+            fname = fname.encode(_watchmanencoding)
+
         if _fixencoding:
             fname = _watchmantofsencoding(fname)
+
         if switch_slashes:
             fname = fname.replace(b'\\', b'/')
         if normalize: