changeset 44829:017cc5ee537f stable

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
author Connor Sheehan <sheehan@mozilla.com>
date Tue, 19 May 2020 16:18:41 -0400
parents 50416d3d4b65
children 91e509a12dbc
files hgext/fsmonitor/__init__.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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