Patchwork D7205: fsmonitor: fix str/bytes mismatch when accessing watchman version

login
register
mail settings
Submitter phabricator
Date Nov. 2, 2019, 10:04 p.m.
Message ID <differential-rev-PHID-DREV-vize4dxmaylzipap2zp4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42687/
State Superseded
Headers show

Comments

phabricator - Nov. 2, 2019, 10:04 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  There were 2 bugs here. First, keys in the tuple are always
  str. Second, we needed to normalize the value to bytes to
  prevent a str/bytes mismatch on Python 3.
  
  With this commit, `hg debuginstall` with fsmonitor enabled now
  works on Python 3.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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
@@ -190,7 +190,7 @@ 
         fm.write(
             b"fsmonitor-watchman-version",
             _(b" watchman binary version %s\n"),
-            v[b"version"],
+            pycompat.bytestr(v["version"]),
         )
     except watchmanclient.Unavailable as e:
         err = str(e)