Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
33047:de8e3681c402 | 33048:46fa46608ca5 |
---|---|
3892 1 f | 3892 1 f |
3893 0 f | 3893 0 f |
3894 | 3894 |
3895 Test namespaces dict | 3895 Test namespaces dict |
3896 | 3896 |
3897 $ hg log -T '{rev}\n{namespaces % " {namespace} color={colorname}\n {join(names, ",")}\n"}\n' | 3897 $ hg --config extensions.revnamesext=$TESTDIR/revnamesext.py log -T '{rev}\n{namespaces % " {namespace} color={colorname} builtin={builtin}\n {join(names, ",")}\n"}\n' |
3898 2 | 3898 2 |
3899 bookmarks color=bookmark | 3899 bookmarks color=bookmark builtin=True |
3900 bar,foo | 3900 bar,foo |
3901 tags color=tag | 3901 tags color=tag builtin=True |
3902 tip | 3902 tip |
3903 branches color=branch | 3903 branches color=branch builtin=True |
3904 text.{rev} | 3904 text.{rev} |
3905 revnames color=revname builtin=False | |
3906 r2 | |
3905 | 3907 |
3906 1 | 3908 1 |
3907 bookmarks color=bookmark | 3909 bookmarks color=bookmark builtin=True |
3908 baz | 3910 baz |
3909 tags color=tag | 3911 tags color=tag builtin=True |
3910 | 3912 |
3911 branches color=branch | 3913 branches color=branch builtin=True |
3912 text.{rev} | 3914 text.{rev} |
3915 revnames color=revname builtin=False | |
3916 r1 | |
3913 | 3917 |
3914 0 | 3918 0 |
3915 bookmarks color=bookmark | 3919 bookmarks color=bookmark builtin=True |
3916 | 3920 |
3917 tags color=tag | 3921 tags color=tag builtin=True |
3918 | 3922 |
3919 branches color=branch | 3923 branches color=branch builtin=True |
3920 default | 3924 default |
3925 revnames color=revname builtin=False | |
3926 r0 | |
3921 | 3927 |
3922 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}' | 3928 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}' |
3923 bookmarks: bar foo | 3929 bookmarks: bar foo |
3924 tags: tip | 3930 tags: tip |
3925 branches: text.{rev} | 3931 branches: text.{rev} |