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

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Nov 2 22:04:24 UTC 2019


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

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)



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


More information about the Mercurial-devel mailing list