diff --git a/mercurial/commands.py b/mercurial/commands.py
index ad40d307a9f03cdb71bc4cfef576618e826735fc_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..ba2c04059317fc144581b58a432e21f6c8d54492_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -61,6 +61,7 @@
     phases,
     policy,
     pvec,
+    pycompat,
     repair,
     revlog,
     revset,
@@ -3160,7 +3161,7 @@
         if os.path.isdir(spec):
             spec += '/'
         spec = spec[len(rootdir):]
-        fixpaths = os.sep != '/'
+        fixpaths = pycompat.ossep != '/'
         if fixpaths:
             spec = spec.replace(os.sep, '/')
         speclen = len(spec)
@@ -3755,7 +3756,7 @@
     if not items:
         return
     f = lambda fn: fn
-    if ui.configbool('ui', 'slash') and os.sep != '/':
+    if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
         f = lambda fn: util.normpath(fn)
     fmt = 'f  %%-%ds  %%-%ds  %%s' % (
         max([len(abs) for abs in items]),
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
index ad40d307a9f03cdb71bc4cfef576618e826735fc_bWVyY3VyaWFsL2RpcnN0YXRlLnB5..ba2c04059317fc144581b58a432e21f6c8d54492_bWVyY3VyaWFsL2RpcnN0YXRlLnB5 100644
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -21,6 +21,7 @@
     osutil,
     parsers,
     pathutil,
+    pycompat,
     scmutil,
     util,
 )
@@ -215,7 +216,7 @@
 
     @propertycache
     def _slash(self):
-        return self._ui.configbool('ui', 'slash') and os.sep != '/'
+        return self._ui.configbool('ui', 'slash') and pycompat.ossep != '/'
 
     @propertycache
     def _checklink(self):
diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
index ad40d307a9f03cdb71bc4cfef576618e826735fc_bWVyY3VyaWFsL3B1cmUvb3N1dGlsLnB5..ba2c04059317fc144581b58a432e21f6c8d54492_bWVyY3VyaWFsL3B1cmUvb3N1dGlsLnB5 100644
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -14,7 +14,11 @@
 import stat as statmod
 import sys
 
-from . import policy
+from . import (
+    policy,
+    pycompat,
+)
+
 modulepolicy = policy.policy
 policynocffi = policy.policynocffi
 
@@ -51,8 +55,8 @@
     '''
     result = []
     prefix = path
-    if not prefix.endswith(os.sep):
-        prefix += os.sep
+    if not prefix.endswith(pycompat.ossep):
+        prefix += pycompat.ossep
     names = os.listdir(path)
     names.sort()
     for fn in names: