Show More
@@ -554,13 +554,24 def shownamespaces(**args): | |||
|
554 | 554 | args = pycompat.byteskwargs(args) |
|
555 | 555 | ctx = args['ctx'] |
|
556 | 556 | repo = ctx.repo() |
|
557 | namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()), | |
|
558 | args)) | |
|
559 | for k, ns in repo.names.iteritems()) | |
|
557 | ||
|
558 | namespaces = util.sortdict() | |
|
559 | colornames = {} | |
|
560 | ||
|
561 | for k, ns in repo.names.iteritems(): | |
|
562 | namespaces[k] = showlist('name', ns.names(repo, ctx.node()), args) | |
|
563 | colornames[k] = ns.colorname | |
|
564 | ||
|
560 | 565 | f = _showlist('namespace', list(namespaces), args) |
|
561 | return _hybrid(f, namespaces, | |
|
562 | lambda k: {'namespace': k, 'names': namespaces[k]}, | |
|
563 | lambda x: x['namespace']) | |
|
566 | ||
|
567 | def makemap(ns): | |
|
568 | return { | |
|
569 | 'namespace': ns, | |
|
570 | 'names': namespaces[ns], | |
|
571 | 'colorname': colornames[ns], | |
|
572 | } | |
|
573 | ||
|
574 | return _hybrid(f, namespaces, makemap, lambda x: x['namespace']) | |
|
564 | 575 | |
|
565 | 576 | @templatekeyword('node') |
|
566 | 577 | def shownode(repo, ctx, templ, **args): |
@@ -3894,10 +3894,31 Test active bookmark templating | |||
|
3894 | 3894 | |
|
3895 | 3895 | Test namespaces dict |
|
3896 | 3896 | |
|
3897 | $ hg log -T '{rev}{namespaces % " {namespace}={join(names, ",")}"}\n' | |
|
3898 | 2 bookmarks=bar,foo tags=tip branches=text.{rev} | |
|
3899 | 1 bookmarks=baz tags= branches=text.{rev} | |
|
3900 | 0 bookmarks= tags= branches=default | |
|
3897 | $ hg log -T '{rev}\n{namespaces % " {namespace} color={colorname}\n {join(names, ",")}\n"}\n' | |
|
3898 | 2 | |
|
3899 | bookmarks color=bookmark | |
|
3900 | bar,foo | |
|
3901 | tags color=tag | |
|
3902 | tip | |
|
3903 | branches color=branch | |
|
3904 | text.{rev} | |
|
3905 | ||
|
3906 | 1 | |
|
3907 | bookmarks color=bookmark | |
|
3908 | baz | |
|
3909 | tags color=tag | |
|
3910 | ||
|
3911 | branches color=branch | |
|
3912 | text.{rev} | |
|
3913 | ||
|
3914 | 0 | |
|
3915 | bookmarks color=bookmark | |
|
3916 | ||
|
3917 | tags color=tag | |
|
3918 | ||
|
3919 | branches color=branch | |
|
3920 | default | |
|
3921 | ||
|
3901 | 3922 | $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}' |
|
3902 | 3923 | bookmarks: bar foo |
|
3903 | 3924 | tags: tip |
General Comments 0
You need to be logged in to leave comments.
Login now