Пример #1
0
def remotebrancheskw(**args):
    """:remotebranches: List of strings. Any remote branch associated
    with the changeset.
    """
    repo, ctx = args['repo'], args['ctx']
    remotenodes = {}
    for name, node in repo._remotebranches.iteritems():
        remotenodes.setdefault(node, []).append(name)
    if ctx.node() in remotenodes:
        names = sorted(remotenodes[ctx.node()])
        try:
            return templatekw.showlist('remotebranch', names,
                                       plural='remotebranches', **args)
        except TypeError:
            # changed in hg 4.2
            return templatekw.showlist('remotebranch', names, args,
                                       plural='remotebranches')
Пример #2
0
def showtasks(**args):
    """String. Return the tasks associated with given hg rev."""
    tasks = []
    descr = args['ctx'].description()
    match = re.search('(Tasks?|Task ID):(.*)', descr)
    if match:
        tasks = re.findall('\d+', match.group(0))
    return templatekw.showlist('task', tasks, args)
Пример #3
0
def remotebrancheskw(**args):
    """:remotebranches: List of strings. Any remote branch associated
    with the changeset.
    """
    repo, ctx = args['repo'], args['ctx']
    remotenodes = {}
    for name, node in repo._remotebranches.iteritems():
        remotenodes.setdefault(node, []).append(name)
    if ctx.node() in remotenodes:
        names = sorted(remotenodes[ctx.node()])
        try:
            return templatekw.showlist('remotebranch', names,
                                       plural='remotebranches', **args)
        except TypeError:
            # changed in hg 4.2
            return templatekw.showlist('remotebranch', names, args,
                                       plural='remotebranches')
Пример #4
0
def template_reviews(repo, ctx, revcache, **args):
    """:reviews: List. Objects describing each review for this changeset."""
    if "reviews" not in revcache:
        reviews = []
        for rid in sorted(repo.reviews.findnodereviews(ctx.node())):
            r = repo.reviews.getreviewrequest(rid)
            # Bug 1065022 add parent review info to this data structure.
            reviews.append({"url": repo.reviews.reviewurl(rid), "status": r.get("status")})

        revcache["reviews"] = reviews
    return templatekw.showlist("review", revcache["reviews"])
Пример #5
0
def template_reviews(repo, ctx, revcache, **args):
    """:reviews: List. Objects describing each review for this changeset."""
    if 'reviews' not in revcache:
        reviews = []
        for rid in sorted(repo.reviews.findnodereviews(ctx.node())):
            r = repo.reviews.getreviewrequest(rid)
            # Bug 1065022 add parent review info to this data structure.
            reviews.append({
                'url': repo.reviews.reviewurl(rid),
                'status': r.get('status'),
            })

        revcache['reviews'] = reviews

    # Mercurial 4.2+ take mapping as a positional argument. Older versions
    # take mapping as **kwargs.
    if 'mapping' in inspect.getargspec(templatekw.showlist).args:
       return templatekw.showlist('review', revcache['reviews'], {})
    else:
        return templatekw.showlist('review', revcache['reviews'])
Пример #6
0
def remotebrancheskw(**args):
    """:remotebranches: List of strings. Any remote branch associated
    with the changeset.
    """
    repo, ctx = args["repo"], args["ctx"]
    remotenodes = {}
    for name, node in repo._remotebranches.iteritems():
        remotenodes.setdefault(node, []).append(name)
    if ctx.node() in remotenodes:
        names = sorted(remotenodes[ctx.node()])
        return templatekw.showlist("remotebranch", names, plural="remotebranches", **args)
Пример #7
0
def template_reviews(repo, ctx, revcache, **args):
    """:reviews: List. Objects describing each review for this changeset."""
    if 'reviews' not in revcache:
        reviews = []
        for rid in sorted(repo.reviews.findnodereviews(ctx.node())):
            r = repo.reviews.getreviewrequest(rid)
            # Bug 1065022 add parent review info to this data structure.
            reviews.append({
                'url': repo.reviews.reviewurl(rid),
                'status': r.get('status'),
            })

        revcache['reviews'] = reviews
    return templatekw.showlist('review', revcache['reviews'])
Пример #8
0
def undosuccessors(repo, ctx, **args):
    """Return all of the node's successors created as a result of undo"""
    asnodes = list(modifysuccessors(ctx, 'undo'))
    return templatekw.showlist('undosuccessor', asnodes, args)
Пример #9
0
def rebasesuccessors(repo, ctx, **args):
    """Return all of the node's successors created as a result of rebase"""
    rsnodes = list(modifysuccessors(ctx, 'rebase'))
    return templatekw.showlist('rebasesuccessor', rsnodes, args)
Пример #10
0
def undosuccessors(repo, ctx, **args):
    """Return all of the node's successors created as a result of undo"""
    asnodes = list(modifysuccessors(ctx, 'undo'))
    return templatekw.showlist('undosuccessor', asnodes, args)
Пример #11
0
def rebasesuccessors(repo, ctx, **args):
    """Return all of the node's successors created as a result of rebase"""
    rsnodes = list(modifysuccessors(ctx, 'rebase'))
    return templatekw.showlist('rebasesuccessor', rsnodes, args)