Patchwork D1036: codemod: use pycompat.isposix

login
register
mail settings
Submitter phabricator
Date Oct. 12, 2017, 4:38 p.m.
Message ID <differential-rev-PHID-DREV-3l5rlzl7fl5zturebyyv-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24797/
State Superseded
Headers show

Comments

phabricator - Oct. 12, 2017, 4:38 p.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is done by:
  
    sed -i "s/pycompat\.osname == 'posix'/pycompat.isposix/" **/*.py

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/largefiles/lfutil.py
  mercurial/util.py
  mercurial/worker.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -53,7 +53,7 @@ 
             raise error.Abort(_('number of cpus must be an integer'))
     return min(max(countcpus(), 4), 32)
 
-if pycompat.osname == 'posix':
+if pycompat.isposix:
     _startupcost = 0.01
 else:
     _startupcost = 1e30
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -313,7 +313,7 @@ 
             return memoryview(sliceable)[offset:offset + length]
         return memoryview(sliceable)[offset:]
 
-closefds = pycompat.osname == 'posix'
+closefds = pycompat.isposix
 
 _chunksize = 4096
 
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -84,7 +84,7 @@ 
         home = encoding.environ.get('HOME')
         if home:
             return os.path.join(home, 'Library', 'Caches', longname)
-    elif pycompat.osname == 'posix':
+    elif pycompat.isposix:
         path = encoding.environ.get('XDG_CACHE_HOME')
         if path:
             return os.path.join(path, longname)