# HG changeset patch # User Connor Sheehan # Date 2020-05-19 20:18:41 # 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 --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -667,7 +667,7 @@ def overridestatus( 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