# HG changeset patch # User Connor Sheehan # Date 1589919521 14400 # Node ID 017cc5ee537f058f769bc30f8096eeee52a0afe2 # Parent 50416d3d4b651d93e74e892587ad40107462569f fsmonitor: coerce `clock` variable to byte-string (issue6321) Callers of `fsmonitor.state.setlastclock` pass their arguments wrapped in `pycompat.sysbytes` to ensure the value is a `bytes` on Python 3. However in `fsmonitor.poststatus.__call__`, if the return value of `getlastclock()` is `None`, we use the value of `fsmonitor.poststatus._startclock` instead, which is not converted to a byte string in the same manner. This commit converts the value of `startclock` to a byte string using `pycompat.sysbytes` in the constructor for `poststatus`, to avoid the "`str` + `bytes`" error from issue 6321. Differential Revision: https://phab.mercurial-scm.org/D8573 diff -r 50416d3d4b65 -r 017cc5ee537f hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py Thu May 14 23:14:24 2020 -0400 +++ b/hgext/fsmonitor/__init__.py Tue May 19 16:18:41 2020 -0400 @@ -667,7 +667,7 @@ class poststatus(object): def __init__(self, startclock): - self._startclock = startclock + self._startclock = pycompat.sysbytes(startclock) def __call__(self, wctx, status): clock = wctx.repo()._fsmonitorstate.getlastclock() or self._startclock