예제 #1
0
def extshelp():
    rst = loaddoc('extensions')().splitlines(True)
    rst.extend(listexts(
        _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
    rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
    doc = ''.join(rst)
    return doc
예제 #2
0
def extshelp():
    rst = loaddoc('extensions')().splitlines(True)
    rst.extend(listexts(
        _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
    rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
    doc = ''.join(rst)
    return doc
예제 #3
0
파일: help.py 프로젝트: MezzLabs/mercurial
def extshelp():
    doc = loaddoc('extensions')()

    exts, maxlength = extensions.enabled()
    doc += listexts(_('enabled extensions:'), exts, maxlength)

    exts, maxlength = extensions.disabled()
    doc += listexts(_('disabled extensions:'), exts, maxlength)

    return doc
예제 #4
0
파일: help.py 프로젝트: ezc/mercurial
def extshelp():
    doc = loaddoc('extensions')()

    exts, maxlength = extensions.enabled()
    doc += listexts(_('enabled extensions:'), exts, maxlength)

    exts, maxlength = extensions.disabled()
    doc += listexts(_('disabled extensions:'), exts, maxlength)

    return doc
예제 #5
0
def topicmatch(kw):
    """Return help topics matching kw.

    Returns {'section': [(name, summary), ...], ...} where section is
    one of topics, commands, extensions, or extensioncommands.
    """
    kw = encoding.lower(kw)

    def lowercontains(container):
        return kw in encoding.lower(container)  # translated in helptable

    results = {
        'topics': [],
        'commands': [],
        'extensions': [],
        'extensioncommands': [],
    }
    for names, header, doc in helptable:
        # Old extensions may use a str as doc.
        if (sum(map(lowercontains, names)) or lowercontains(header)
                or (callable(doc) and lowercontains(doc()))):
            results['topics'].append((names[0], header))
    import commands  # avoid cycle
    for cmd, entry in commands.table.iteritems():
        if len(entry) == 3:
            summary = entry[2]
        else:
            summary = ''
        # translate docs *before* searching there
        docs = _(getattr(entry[0], '__doc__', None)) or ''
        if kw in cmd or lowercontains(summary) or lowercontains(docs):
            doclines = docs.splitlines()
            if doclines:
                summary = doclines[0]
            cmdname = cmd.split('|')[0].lstrip('^')
            results['commands'].append((cmdname, summary))
    for name, docs in itertools.chain(
            extensions.enabled(False).iteritems(),
            extensions.disabled().iteritems()):
        # extensions.load ignores the UI argument
        mod = extensions.load(None, name, '')
        name = name.split('.')[-1]
        if lowercontains(name) or lowercontains(docs):
            # extension docs are already translated
            results['extensions'].append((name, docs.splitlines()[0]))
        for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
            if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
                cmdname = cmd.split('|')[0].lstrip('^')
                if entry[0].__doc__:
                    cmddoc = gettext(entry[0].__doc__).splitlines()[0]
                else:
                    cmddoc = _('(no help text available)')
                results['extensioncommands'].append((cmdname, cmddoc))
    return results
예제 #6
0
def topicmatch(kw):
    """Return help topics matching kw.

    Returns {'section': [(name, summary), ...], ...} where section is
    one of topics, commands, extensions, or extensioncommands.
    """
    kw = encoding.lower(kw)
    def lowercontains(container):
        return kw in encoding.lower(container)  # translated in helptable
    results = {'topics': [],
               'commands': [],
               'extensions': [],
               'extensioncommands': [],
               }
    for names, header, doc in helptable:
        if (sum(map(lowercontains, names))
            or lowercontains(header)
            or lowercontains(doc())):
            results['topics'].append((names[0], header))
    import commands # avoid cycle
    for cmd, entry in commands.table.iteritems():
        if cmd.startswith('debug'):
            continue
        if len(entry) == 3:
            summary = entry[2]
        else:
            summary = ''
        # translate docs *before* searching there
        docs = _(getattr(entry[0], '__doc__', None)) or ''
        if kw in cmd or lowercontains(summary) or lowercontains(docs):
            doclines = docs.splitlines()
            if doclines:
                summary = doclines[0]
            cmdname = cmd.split('|')[0].lstrip('^')
            results['commands'].append((cmdname, summary))
    for name, docs in itertools.chain(
        extensions.enabled(False).iteritems(),
        extensions.disabled().iteritems()):
        # extensions.load ignores the UI argument
        mod = extensions.load(None, name, '')
        name = name.split('.')[-1]
        if lowercontains(name) or lowercontains(docs):
            # extension docs are already translated
            results['extensions'].append((name, docs.splitlines()[0]))
        for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
            if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
                cmdname = cmd.split('|')[0].lstrip('^')
                if entry[0].__doc__:
                    cmddoc = gettext(entry[0].__doc__).splitlines()[0]
                else:
                    cmddoc = _('(no help text available)')
                results['extensioncommands'].append((cmdname, cmddoc))
    return results
예제 #7
0
파일: help.py 프로젝트: dkrisman/Traipse
def extshelp():
    doc = _(
        r"""
    Mercurial has the ability to add new features through the use of
    extensions. Extensions may add new commands, add options to
    existing commands, change the default behavior of commands, or
    implement hooks.

    Extensions are not loaded by default for a variety of reasons:
    they can increase startup overhead; they may be meant for
    advanced usage only; they may provide potentially dangerous
    abilities (such as letting you destroy or modify history); they
    might not be ready for prime time; or they may alter some
    usual behaviors of stock Mercurial. It is thus up to the user to
    activate extensions as needed.

    To enable the "foo" extension, either shipped with Mercurial
    or in the Python search path, create an entry for it in your
    hgrc, like this:

      [extensions]
      foo =

    You may also specify the full path to an extension:

      [extensions]
      myfeature = ~/.hgext/myfeature.py

    To explicitly disable an extension enabled in an hgrc of broader
    scope, prepend its path with !:

      [extensions]
      # disabling extension bar residing in /path/to/extension/bar.py
      hgext.bar = !/path/to/extension/bar.py
      # ditto, but no path was supplied for extension baz
      hgext.baz = !
    """
    )

    exts, maxlength = extensions.enabled()
    doc += listexts(_("enabled extensions:"), exts, maxlength)

    exts, maxlength = extensions.disabled()
    doc += listexts(_("disabled extensions:"), exts, maxlength)

    return doc
예제 #8
0
def extshelp():
    doc = _(r'''
    Mercurial has the ability to add new features through the use of
    extensions. Extensions may add new commands, add options to
    existing commands, change the default behavior of commands, or
    implement hooks.

    Extensions are not loaded by default for a variety of reasons:
    they can increase startup overhead; they may be meant for advanced
    usage only; they may provide potentially dangerous abilities (such
    as letting you destroy or modify history); they might not be ready
    for prime time; or they may alter some usual behaviors of stock
    Mercurial. It is thus up to the user to activate extensions as
    needed.

    To enable the "foo" extension, either shipped with Mercurial or in
    the Python search path, create an entry for it in your hgrc, like
    this::

      [extensions]
      foo =

    You may also specify the full path to an extension::

      [extensions]
      myfeature = ~/.hgext/myfeature.py

    To explicitly disable an extension enabled in an hgrc of broader
    scope, prepend its path with !::

      [extensions]
      # disabling extension bar residing in /path/to/extension/bar.py
      hgext.bar = !/path/to/extension/bar.py
      # ditto, but no path was supplied for extension baz
      hgext.baz = !
    ''')

    exts, maxlength = extensions.enabled()
    doc += listexts(_('enabled extensions:'), exts, maxlength)

    exts, maxlength = extensions.disabled()
    doc += listexts(_('disabled extensions:'), exts, maxlength)

    return doc