mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
6ec7546cab
Summary: Automatic upgrade to remove `version` override and silence errors. Reviewed By: grievejia Differential Revision: D21207287 fbshipit-source-id: ab82cf81690cb847bd130ff3448345f5a0ea19af
43 lines
1.1 KiB
Python
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))
|