Mercurial > hg
comparison hgext/fsmonitor/__init__.py @ 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 | 9d2b2df2c2ba |
children | c1d6e930ac8a |
comparison
equal
deleted
inserted
replaced
44828:50416d3d4b65 | 44829:017cc5ee537f |
---|---|
665 ) | 665 ) |
666 | 666 |
667 | 667 |
668 class poststatus(object): | 668 class poststatus(object): |
669 def __init__(self, startclock): | 669 def __init__(self, startclock): |
670 self._startclock = startclock | 670 self._startclock = pycompat.sysbytes(startclock) |
671 | 671 |
672 def __call__(self, wctx, status): | 672 def __call__(self, wctx, status): |
673 clock = wctx.repo()._fsmonitorstate.getlastclock() or self._startclock | 673 clock = wctx.repo()._fsmonitorstate.getlastclock() or self._startclock |
674 hashignore = _hashignore(wctx.repo().dirstate._ignore) | 674 hashignore = _hashignore(wctx.repo().dirstate._ignore) |
675 notefiles = ( | 675 notefiles = ( |