D8573: fsmonitor: coerce `clock` variable to byte-string (issue6321)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

D8573: fsmonitor: coerce `clock` variable to byte-string (issue6321)

valentin.gatienbaron (Valentin Gatien-Baron)
sheehan created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8573

AFFECTED FILES
  hgext/fsmonitor/__init__.py

CHANGE DETAILS

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



To: sheehan, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel