sapling/eden/scm/edenscm/mercurial/__init__.py
Shannon Zhu 6ec7546cab Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: grievejia

Differential Revision: D21207287

fbshipit-source-id: ab82cf81690cb847bd130ff3448345f5a0ea19af
2020-04-23 12:09:39 -07:00

43 lines
1.1 KiB
Python

# Portions Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# __init__.py - Startup and module loading logic for Mercurial.
#
# Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import os
import sys
# Allow 'from mercurial import demandimport' to keep working.
from edenscm import hgdemandimport
# pyre-fixme[11]: Annotation `hgdemandimport` is not defined as a type.
demandimport = hgdemandimport
__all__ = []
if getattr(sys, "platform") == "win32":
configdir = os.path.join(
getattr(os, "environ").get("PROGRAMDATA") or "\ProgramData",
"Facebook",
"Mercurial",
)
else:
configdir = "/etc/mercurial"
def shoulduselegacy(name):
legacy = getattr(os, "environ").get("HGLEGACY")
if legacy is not None:
return name in legacy.split()
else:
return os.path.lexists(os.path.join(configdir, "legacy.%s" % name))