D1033: pycompat: define operating system constants

quark (Jun Wu) phabricator at mercurial-scm.org
Thu Oct 12 16:37:33 UTC 2017


quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As suggested by Ryan in https://phab.mercurial-scm.org/D1019, it's cleaner if we use defined constants
  instead of `osname == 'nt'` everywhere.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/pycompat.py

CHANGE DETAILS

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -19,6 +19,10 @@
 ispypy = (r'__pypy__' in sys.builtin_module_names)
 isjython = sys.platform.startswith(r'java')
 
+isdarwin = sys.platform == r'darwin'
+isposix = os.name == r'posix'
+iswindows = os.name == r'nt'
+
 if not ispy3:
     import cookielib
     import cPickle as pickle



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


More information about the Mercurial-devel mailing list