Exemple #1
0
def revset_reviewed(repo, subset, x):
    """Changesets that were reviewed."""
    if x:
        raise ParseError(_('reviewed() does not take an argument'))

    return subset.filter(
        lambda x: list(parse_reviewers(repo[x].description())))
def template_dates(context, mapping, args):
    """:dates(VALUES, [fmt, [sep]]): Format a list of dates."""
    if not (1 <= len(args) <= 3):
        raise ParseError(_("dates expects one, two, or three arguments"))

    fmt = '%Y-%m-%d'
    sep = ','

    if len(args) > 1:
        fmt = templatefilters.stringify(args[1][0](context, mapping,
                                                   args[1][1]))
    if len(args) > 2:
        sep = templatefilters.stringify(args[2][0](context, mapping,
                                                   args[2][1]))

    return sep.join(
        util.datestr(d, fmt) for d in args[0][0](context, mapping, args[0][1]))
Exemple #3
0
def revset_bug(repo, subset, x):
    """Changesets referencing a specified Bugzilla bug. e.g. bug(123456)."""
    err = _('bug() requires an integer argument.')
    bugstring = revset.getstring(x, err)

    try:
        bug = int(bugstring)
    except Exception:
        raise ParseError(err)

    def fltr(x):
        # We do a simple string test first because avoiding regular expressions
        # is good for performance.
        desc = repo[x].description()
        return bugstring in desc and bug in parse_bugs(desc)

    return subset.filter(fltr)
Exemple #4
0
def revset_me(repo, subset, x):
    """Changesets that you are involved in."""
    if x:
        raise ParseError(_('me() does not take any arguments'))

    me = repo.ui.config('ui', 'username')
    if not me:
        raise error.Abort(_('"[ui] username" must be set to use me()'))

    ircnick = get_ircnick(repo.ui)

    n = encoding.lower(me)
    kind, pattern, matcher = revset._substringmatcher(n)

    def fltr(x):
        ctx = repo[x]
        if matcher(encoding.lower(ctx.user())):
            return True

        return ircnick in parse_reviewers(ctx.description())

    return subset.filter(fltr)
def revset_nobug(repo, subset, x):
    if x:
        raise ParseError(_('nobug() does not take any arguments'))

    return subset.filter(lambda x: not parse_bugs(repo[x].description()))
def revset_dontbuild(repo, subset, x):
    if x:
        raise ParseError(_('dontbuild() does not take any arguments'))

    return subset.filter(lambda x: 'DONTBUILD' in repo[x].description())