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
--- 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