コード例 #1
0
def author(repo, subset, x):
    """``author(string)``
    Alias for ``user(string)``.
    """
    # i18n: "author" is a keyword
    n = encoding.lower(getstring(x, _("author requires a string")))
    return [r for r in subset if n in encoding.lower(repo[r].user())]
コード例 #2
0
ファイル: revset.py プロジェクト: agbiotec/galaxy-tools-vcr
def author(repo, subset, x):
    """``author(string)``
    Alias for ``user(string)``.
    """
    # i18n: "author" is a keyword
    n = encoding.lower(getstring(x, _("author requires a string")))
    return [r for r in subset if n in encoding.lower(repo[r].user())]
コード例 #3
0
def desc(repo, subset, x):
    """``desc(string)``
    Search commit message for string. The match is case-insensitive.
    """
    # i18n: "desc" is a keyword
    ds = encoding.lower(getstring(x, _("desc requires a string")))
    l = []
    for r in subset:
        c = repo[r]
        if ds in encoding.lower(c.description()):
            l.append(r)
    return l
コード例 #4
0
ファイル: revset.py プロジェクト: agbiotec/galaxy-tools-vcr
def desc(repo, subset, x):
    """``desc(string)``
    Search commit message for string. The match is case-insensitive.
    """
    # i18n: "desc" is a keyword
    ds = encoding.lower(getstring(x, _("desc requires a string")))
    l = []
    for r in subset:
        c = repo[r]
        if ds in encoding.lower(c.description()):
            l.append(r)
    return l
コード例 #5
0
ファイル: revset.py プロジェクト: agbiotec/galaxy-tools-vcr
def keyword(repo, subset, x):
    """``keyword(string)``
    Search commit message, user name, and names of changed files for
    string. The match is case-insensitive.
    """
    # i18n: "keyword" is a keyword
    kw = encoding.lower(getstring(x, _("keyword requires a string")))
    l = []
    for r in subset:
        c = repo[r]
        t = " ".join(c.files() + [c.user(), c.description()])
        if kw in encoding.lower(t):
            l.append(r)
    return l
コード例 #6
0
def keyword(repo, subset, x):
    """``keyword(string)``
    Search commit message, user name, and names of changed files for
    string. The match is case-insensitive.
    """
    # i18n: "keyword" is a keyword
    kw = encoding.lower(getstring(x, _("keyword requires a string")))
    l = []
    for r in subset:
        c = repo[r]
        t = " ".join(c.files() + [c.user(), c.description()])
        if kw in encoding.lower(t):
            l.append(r)
    return l
コード例 #7
0
ファイル: scmutil.py プロジェクト: jordigh/mercurial-crew
 def __call__(self, f):
     fl = encoding.lower(f)
     if fl in self._loweredfiles and f not in self._dirstate and f not in self._newfiles:
         msg = _("possible case-folding collision for %s") % f
         if self._abort:
             raise util.Abort(msg)
         self._ui.warn(_("warning: %s\n") % msg)
     self._loweredfiles.add(fl)
     self._newfiles.add(f)
コード例 #8
0
 def __call__(self, f):
     fl = encoding.lower(f)
     map = self._map
     if fl in map and map[fl] != f:
         msg = _('possible case-folding collision for %s') % f
         if self._abort:
             raise util.Abort(msg)
         self._ui.warn(_("warning: %s\n") % msg)
     map[fl] = f
コード例 #9
0
ファイル: scmutil.py プロジェクト: sandeepprasanna/ODOO
 def __call__(self, f):
     fl = encoding.lower(f)
     map = self._map
     if fl in map and map[fl] != f:
         msg = _('possible case-folding collision for %s') % f
         if self._abort:
             raise util.Abort(msg)
         self._ui.warn(_("warning: %s\n") % msg)
     map[fl] = f
コード例 #10
0
def _checkcollision(mctx):
    "check for case folding collisions in the destination context"
    folded = {}
    for fn in mctx:
        fold = encoding.lower(fn)
        if fold in folded:
            raise util.Abort(_("case-folding collision between %s and %s")
                             % (fn, folded[fold]))
        folded[fold] = fn
コード例 #11
0
 def __init__(self, ui, abort, dirstate):
     self._ui = ui
     self._abort = abort
     allfiles = '\0'.join(dirstate._map)
     self._loweredfiles = set(encoding.lower(allfiles).split('\0'))
     self._dirstate = dirstate
     # The purpose of _newfiles is so that we don't complain about
     # case collisions if someone were to call this object with the
     # same filename twice.
     self._newfiles = set()
コード例 #12
0
ファイル: scmutil.py プロジェクト: gobizen/hg-stable
 def __call__(self, f):
     fl = encoding.lower(f)
     if (fl in self._loweredfiles and f not in self._dirstate
             and f not in self._newfiles):
         msg = _('possible case-folding collision for %s') % f
         if self._abort:
             raise util.Abort(msg)
         self._ui.warn(_("warning: %s\n") % msg)
     self._loweredfiles.add(fl)
     self._newfiles.add(f)
コード例 #13
0
ファイル: scmutil.py プロジェクト: CSCI-362-02-2015/RedTeam
 def __init__(self, ui, abort, dirstate):
     self._ui = ui
     self._abort = abort
     allfiles = '\0'.join(dirstate._map)
     self._loweredfiles = set(encoding.lower(allfiles).split('\0'))
     self._dirstate = dirstate
     # The purpose of _newfiles is so that we don't complain about
     # case collisions if someone were to call this object with the
     # same filename twice.
     self._newfiles = set()
コード例 #14
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
コード例 #15
0
ファイル: help.py プロジェクト: jordigh/mercurial-crew
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
コード例 #16
0
ファイル: scmutil.py プロジェクト: sandeepprasanna/ODOO
 def __init__(self, ui, abort, existingiter):
     self._ui = ui
     self._abort = abort
     self._map = {}
     for f in existingiter:
         self._map[encoding.lower(f)] = f
コード例 #17
0
 def lowercontains(container):
     return kw in encoding.lower(container)  # translated in helptable
コード例 #18
0
ファイル: templatefilters.py プロジェクト: RayFerr000/PLTL
def lower(text):
    """:lower: Any text. Converts the text to lowercase."""
    return encoding.lower(text)
コード例 #19
0
ファイル: help.py プロジェクト: pierfort123/mercurial
 def lowercontains(container):
     return kw in encoding.lower(container)  # translated in helptable
コード例 #20
0
 def __init__(self, ui, abort, existingiter):
     self._ui = ui
     self._abort = abort
     self._map = {}
     for f in existingiter:
         self._map[encoding.lower(f)] = f
コード例 #21
0
def lower(text):
    """:lower: Any text. Converts the text to lowercase."""
    return encoding.lower(text)