mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
551df960c9
Summary: - minimize aliases - simplify synopsis - tweak wording and formatting Reviewed By: DurhamG Differential Revision: D41292833 fbshipit-source-id: b77814c7188e892eea4b0f65ce3656ef0656da42
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
# Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
# identity.py - program identity
|
|
#
|
|
# Copyright Olivia Mackall <olivia@selenic.com> and others
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
import functools
|
|
|
|
from bindings import identity
|
|
|
|
sniffroot = identity.sniffroot
|
|
default = identity.default
|
|
|
|
|
|
def templatemap():
|
|
currident = default()
|
|
return {
|
|
"@prog@": currident.cliname(),
|
|
"@PROG@": currident.cliname().upper(),
|
|
"@Product@": currident.productname(),
|
|
"@LongProduct@": currident.longproductname(),
|
|
}
|
|
|
|
|
|
def tmplprefix():
|
|
return default().cliname().upper()
|
|
|
|
|
|
def replace(s):
|
|
"""Replace template instances in the given string"""
|
|
if s is not None:
|
|
for template, replacement in templatemap().items():
|
|
s = s.replace(template, replacement)
|
|
return s
|
|
|
|
|
|
@functools.lru_cache
|
|
def sniffdir(path):
|
|
return identity.sniffdir(path)
|