sapling/hgext3rd/logginghelper.py
Stanislau Hlebik 11e4d7be5a logginghelper: return repo name instead of repo root
Summary:
logginghelper extension returns full path to the repo instead of just repo name.
It makes it hard to aggregate results per repo in scuba.
Use just repo name instead of repo root.
We can get repo name either from `paths.default` config value or
a basename of the repo root.

Test Plan:
Before:
{P56637657}

After:
{P56637661}

Diff
{P56637665}

Reviewers: rmcelroy, ttung, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3827912

Signature: t1:3827912:1473413932:5c38ca48e58a080c97b35610ee8889d66b4d5ab3
2016-09-09 08:07:56 -07:00

32 lines
917 B
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
"""
import os
from mercurial import (
extensions,
localrepo,
)
from mercurial.i18n import _
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)
kwargs = {'repo': reponame}
self.ui.log("logginghelper",
"", # ui.log requires a format string as args[0].
**kwargs)
def uisetup(ui):
extensions.wrapfunction(localrepo.localrepository,
'__init__', _localrepoinit)