コード例 #1
0
    error,
    extensions,
    patch,
    progress,
    pycompat,
    registrar,
    scmutil,
    util,
)
from edenscm.mercurial.i18n import _

from . import context as facontext, error as faerror, formatter as faformatter


cmdtable = {}
command = registrar.command(cmdtable)


def _matchpaths(repo, rev, pats, opts, aopts=facontext.defaultopts):
    """generate paths matching given patterns"""
    perfhack = repo.ui.configbool("fastannotate", "perfhack")

    # disable perfhack if:
    # a) any walkopt is used
    # b) if we treat pats as plain file names, some of them do not have
    #    corresponding linelog files
    if perfhack:
        # cwd related to reporoot
        reporoot = os.path.dirname(repo.path)
        reldir = os.path.relpath(pycompat.getcwd(), reporoot)
        if reldir == ".":
コード例 #2
0
# 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.

from __future__ import absolute_import

import unittest

import edenscm.mercurial.error as error
import edenscm.mercurial.registrar as registrar
import silenttestrunner

command = registrar.command(dict())


@command("notacommand")
def thisisnotacommand(_ui, **opts):
    "yadayadayada"
    return "foo"


command._table["commandstring"] = "Rust commands are actually registered as strings"


class TestRegistrar(unittest.TestCase):
    def testnohelptext(self):
        # Redifining commands should not be an issue as long as they
        # do not have any documentation
        @command("notacommand")
        def thisalreadyexisted(_ui, **opts):