Mercurial > hg
diff hgext/fsmonitor/state.py @ 43392:8a9e53b974ee stable
fsmonitor: normalize hostname to bytes
Without this, we get a str/bytes mismatching when using %
formatting a few lines below.
Differential Revision: https://phab.mercurial-scm.org/D7208
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 02 Nov 2019 13:34:40 -0700 |
parents | 687b865b95ad |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/hgext/fsmonitor/state.py Sat Nov 02 13:30:23 2019 -0700 +++ b/hgext/fsmonitor/state.py Sat Nov 02 13:34:40 2019 -0700 @@ -14,6 +14,7 @@ from mercurial.i18n import _ from mercurial import ( + encoding, pathutil, util, ) @@ -81,7 +82,7 @@ self.invalidate() return None, None, None diskhostname = state[0] - hostname = socket.gethostname() + hostname = encoding.strtolocal(socket.gethostname()) if diskhostname != hostname: # file got moved to a different host self._ui.log( @@ -127,7 +128,7 @@ with file: file.write(struct.pack(_versionformat, _version)) - file.write(socket.gethostname() + b'\0') + file.write(encoding.strtolocal(socket.gethostname()) + b'\0') file.write(clock + b'\0') file.write(ignorehash + b'\0') if notefiles: