diff mercurial/scmposix.py @ 43077:687b865b95ad

formatting: byteify all mercurial/ and hgext/ string literals Done with python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py') black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**') # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6972
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:48:39 -0400
parents 57875cf423c9
children c59eb1560c44
line wrap: on
line diff
--- a/mercurial/scmposix.py	Sun Oct 06 09:45:02 2019 -0400
+++ b/mercurial/scmposix.py	Sun Oct 06 09:48:39 2019 -0400
@@ -16,18 +16,18 @@
 # $MORE variable, but there's no compatible option with Linux 'more'. Given
 # OS X is widely used and most modern Unix systems would have 'less', setting
 # 'less' as the default seems reasonable.
-fallbackpager = 'less'
+fallbackpager = b'less'
 
 
 def _rcfiles(path):
-    rcs = [os.path.join(path, 'hgrc')]
-    rcdir = os.path.join(path, 'hgrc.d')
+    rcs = [os.path.join(path, b'hgrc')]
+    rcdir = os.path.join(path, b'hgrc.d')
     try:
         rcs.extend(
             [
                 os.path.join(rcdir, f)
                 for f, kind in util.listdir(rcdir)
-                if f.endswith(".rc")
+                if f.endswith(b".rc")
             ]
         )
     except OSError:
@@ -37,32 +37,32 @@
 
 def systemrcpath():
     path = []
-    if pycompat.sysplatform == 'plan9':
-        root = 'lib/mercurial'
+    if pycompat.sysplatform == b'plan9':
+        root = b'lib/mercurial'
     else:
-        root = 'etc/mercurial'
+        root = b'etc/mercurial'
     # old mod_python does not set sys.argv
     if len(getattr(sys, 'argv', [])) > 0:
         p = os.path.dirname(os.path.dirname(pycompat.sysargv[0]))
-        if p != '/':
+        if p != b'/':
             path.extend(_rcfiles(os.path.join(p, root)))
-    path.extend(_rcfiles('/' + root))
+    path.extend(_rcfiles(b'/' + root))
     return path
 
 
 def userrcpath():
-    if pycompat.sysplatform == 'plan9':
-        return [encoding.environ['home'] + '/lib/hgrc']
+    if pycompat.sysplatform == b'plan9':
+        return [encoding.environ[b'home'] + b'/lib/hgrc']
     elif pycompat.isdarwin:
-        return [os.path.expanduser('~/.hgrc')]
+        return [os.path.expanduser(b'~/.hgrc')]
     else:
-        confighome = encoding.environ.get('XDG_CONFIG_HOME')
+        confighome = encoding.environ.get(b'XDG_CONFIG_HOME')
         if confighome is None or not os.path.isabs(confighome):
-            confighome = os.path.expanduser('~/.config')
+            confighome = os.path.expanduser(b'~/.config')
 
         return [
-            os.path.expanduser('~/.hgrc'),
-            os.path.join(confighome, 'hg', 'hgrc'),
+            os.path.expanduser(b'~/.hgrc'),
+            os.path.join(confighome, b'hg', b'hgrc'),
         ]
 
 
@@ -82,7 +82,7 @@
                 continue
             if not os.isatty(fd):
                 continue
-            arri = fcntl.ioctl(fd, TIOCGWINSZ, '\0' * 8)
+            arri = fcntl.ioctl(fd, TIOCGWINSZ, b'\0' * 8)
             height, width = array.array(r'h', arri)[:2]
             if width > 0 and height > 0:
                 return width, height