mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
ccf6655f3a
Summary: test-check-code.t now dislikes our docstrings. Fix them up Test Plan: Run the test locally on my devserver Reviewers: #sourcecontrol, durham Reviewed By: durham Subscribers: mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4773908 Signature: t1:4773908:1490394131:9d9e5f85b4243119a3615044605bcc5abdecbe4f
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
# reporootlog.py - log the repo root
|
|
#
|
|
# Copyright 2016 Facebook, Inc.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
"""this extension logs different pieces of information that will be used
|
|
by SCM wrappers
|
|
|
|
::
|
|
|
|
[logging]
|
|
# list of config options to log
|
|
configoptions = section1.option1,section2.option2
|
|
|
|
"""
|
|
|
|
import os
|
|
from mercurial import (
|
|
extensions,
|
|
localrepo,
|
|
)
|
|
|
|
def _localrepoinit(orig, self, baseui, path=None, create=False):
|
|
orig(self, baseui, path, create)
|
|
reponame = self.ui.config('paths', 'default', path)
|
|
if reponame:
|
|
reponame = os.path.basename(reponame)
|
|
configoptstolog = self.ui.configlist('logging', 'configoptions')
|
|
kwargs = {'repo': reponame}
|
|
for option in configoptstolog:
|
|
splitted = option.split('.')
|
|
if len(splitted) != 2:
|
|
continue
|
|
section, name = splitted
|
|
value = self.ui.config(section, name, None)
|
|
if value is not None:
|
|
kwargs[name] = value
|
|
|
|
self.ui.log("logginghelper",
|
|
"", # ui.log requires a format string as args[0].
|
|
**kwargs)
|
|
|
|
def uisetup(ui):
|
|
extensions.wrapfunction(localrepo.localrepository,
|
|
'__init__', _localrepoinit)
|