diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -94,15 +94,16 @@ from __future__ import absolute_import import hashlib import os import stat -import sys from mercurial.i18n import _ from mercurial import ( context, + encoding, extensions, localrepo, merge, pathutil, + pycompat, scmutil, util, ) @@ -292,7 +293,7 @@ def overridewalk(orig, self, match, subr if normalize: foldmap = dict((normcase(k), k) for k in results) - switch_slashes = os.sep == '\\' + switch_slashes = pycompat.ossep == '\\' # The order of the results is, strictly speaking, undefined. # For case changes on a case insensitive filesystem we may receive # two entries, one with exists=True and another with exists=False. @@ -392,8 +393,8 @@ def overridestatus( def _cmpsets(l1, l2): try: - if 'FSMONITOR_LOG_FILE' in os.environ: - fn = os.environ['FSMONITOR_LOG_FILE'] + if 'FSMONITOR_LOG_FILE' in encoding.environ: + fn = encoding.environ['FSMONITOR_LOG_FILE'] f = open(fn, 'wb') else: fn = 'fsmonitorfail.log' @@ -434,7 +435,7 @@ def overridestatus( updatestate = (parentworking and match.always() and not isinstance(ctx2, (context.workingcommitctx, context.memctx)) and - 'HG_PENDING' not in os.environ) + 'HG_PENDING' not in encoding.environ) try: if self._fsmonitorstate.walk_on_invalidate: @@ -545,7 +546,7 @@ def wrapdirstate(orig, self): def extsetup(ui): wrapfilecache(localrepo.localrepository, 'dirstate', wrapdirstate) - if sys.platform == 'darwin': + if pycompat.sysplatform == 'darwin': # An assist for avoiding the dangling-symlink fsevents bug extensions.wrapfunction(os, 'symlink', wrapsymlink) diff --git a/tests/test-check-code.t b/tests/test-check-code.t --- a/tests/test-check-code.t +++ b/tests/test-check-code.t @@ -9,21 +9,6 @@ New errors are not allowed. Warnings are $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman | > sed 's-\\-/-g' | xargs "$check_code" --warnings --per-file=0 || false - hgext/fsmonitor/__init__.py:295: - > switch_slashes = os.sep == '\\' - use pycompat.ossep instead (py3) - hgext/fsmonitor/__init__.py:395: - > if 'FSMONITOR_LOG_FILE' in os.environ: - use encoding.environ instead (py3) - hgext/fsmonitor/__init__.py:396: - > fn = os.environ['FSMONITOR_LOG_FILE'] - use encoding.environ instead (py3) - hgext/fsmonitor/__init__.py:437: - > 'HG_PENDING' not in os.environ) - use encoding.environ instead (py3) - hgext/fsmonitor/__init__.py:548: - > if sys.platform == 'darwin': - use pycompat.sysplatform instead (py3) Skipping i18n/polib.py it has no-che?k-code (glob) mercurial/demandimport.py:309: > if os.environ.get('HGDEMANDIMPORT') != 'disable':