##// END OF EJS Templates
context: move reuse of context object to repo.__getitem__ (API)...
context: move reuse of context object to repo.__getitem__ (API) As an example of how weird the basectx.__new__ is: whenever you create a workingctx, basectx.__new__ gets called first. Since our __new__ has a "changeid" argument as second parameter, when create the workingctx(repo, text="blah"), the text gets bound to "changeid". Since a string isn't a basectx, our __new__ ends up not doing anything funny, but that's still very confusing code. Another case is metadataonlyctx.__new__(), which I think exists in order to prevent metadataonlyctx.__init__'s third argument (originalctx) from being interpreted as a changeid in basectx.__new__(), thereby getting reused. Let's move this to repo.__getitem__ instead, where it will be pretty obvious what the code does. After this patch, changectx(ctx) will be an error (it will fail when trying to see if it's a 20-byte string). Differential Revision: https://phab.mercurial-scm.org/D2969

File last commit:

r34878:eb24f1d1 default
r37191:bb47dc2f default
Show More
map-cmdline.show
21 lines | 1.0 KiB | text/plain | TextLexer
# TODO there are a few deficiencies in this file:
# * The "namespace" of the labels needs to be worked out. We currently
# piggyback on existing values so color works.
%include map-cmdline.default
[templates]
showbookmarks = '{if(active, "*", " ")} {pad(bookmark, longestbookmarklen + 4)}{shortest(node, nodelen)}\n'
showwork = '{cset_shortnode}{namespaces % cset_namespace} {cset_shortdesc}'
showstack = '{showwork}'
cset_shortnode = '{labelcset(shortest(node, nodelen))}'
# Treat branch and tags specially so we don't display "default" or "tip"
cset_namespace = '{ifeq(namespace, "branches", names_branches, ifeq(namespace, "tags", names_tags, names_others))}'
names_branches = '{ifeq(branch, "default", "", " ({label('log.{colorname}', branch)})")}'
names_tags = '{if(names % "{ifeq(name, 'tip', '', name)}", " ({label('log.{colorname}', join(names % "{ifeq(name, 'tip', '', name)}", ' '))})")}'
names_others = '{if(names, " ({label('log.{colorname}', join(names, ' '))})")}'
cset_shortdesc = '{label("log.description", desc|firstline)}'