Mercurial > hg
diff tests/test-command-template.t @ 33048:46fa46608ca5
namespaces: record and expose whether namespace is built-in
Currently, the templating layer tends to treat each namespace
as a one-off, with explicit usage of {bookmarks}, {tags}, {branch},
etc instead of using {namespaces}. It would be really useful if
we could iterate over namespaces and operate on them generically.
However, some consumers may wish to differentiate namespaces by
whether they are built-in to core Mercurial or provided by extensions.
Expected use cases include ignoring non-built-in namespaces or
emitting a generic label for non-built-in namespaces.
This commit introduces an attribute on namespace instances
that says whether the namespace is "built-in" and then exposes
this to the templating layer.
As part of this, we implement a reusable extension for defining
custom names on each changeset for testing. A second consumer
will be introduced in a subsequent commit.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 24 Jun 2017 14:52:15 -0700 |
parents | de8e3681c402 |
children | 8e6f4939a69a |
line wrap: on
line diff
--- a/tests/test-command-template.t Sat Jun 24 13:39:20 2017 -0700 +++ b/tests/test-command-template.t Sat Jun 24 14:52:15 2017 -0700 @@ -3894,30 +3894,36 @@ Test namespaces dict - $ hg log -T '{rev}\n{namespaces % " {namespace} color={colorname}\n {join(names, ",")}\n"}\n' + $ hg --config extensions.revnamesext=$TESTDIR/revnamesext.py log -T '{rev}\n{namespaces % " {namespace} color={colorname} builtin={builtin}\n {join(names, ",")}\n"}\n' 2 - bookmarks color=bookmark + bookmarks color=bookmark builtin=True bar,foo - tags color=tag + tags color=tag builtin=True tip - branches color=branch + branches color=branch builtin=True text.{rev} + revnames color=revname builtin=False + r2 1 - bookmarks color=bookmark + bookmarks color=bookmark builtin=True baz - tags color=tag + tags color=tag builtin=True - branches color=branch + branches color=branch builtin=True text.{rev} + revnames color=revname builtin=False + r1 0 - bookmarks color=bookmark + bookmarks color=bookmark builtin=True + + tags color=tag builtin=True - tags color=tag - - branches color=branch + branches color=branch builtin=True default + revnames color=revname builtin=False + r0 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}' bookmarks: bar foo