Template-based Revision Query (Plan)
This feature is NOT implemented yet.
Overview
- Provides asynchronous, exception-safe and customizable APIs to fetch revision information
- Built on top of Repository Access and Command Execution functions
- Can accept revset query
-
csinfo
,cslist
andrevpanel
will be superseded by this - Templater functions in
repomodel
will be replaced by this
Configuration
Templates can be configured by user.
# visible fields can be selected per form
[thg-revforms]
# form[.style]
# RevDetailsWidget has default (expanded) and compact (single-line) styles
revdetails:fields = cset branch obsolete close user ... git
revdetails.compact:fields = rev summary
revdetails:link = True
# '|' means '\n' for quiet (label) style, '<p>' for verbose (panel) style?
update:fields = rev branch tags | summary
# templates for widgets that use QTextDocument
[thg-revtemplates]
# field[.style] = template; or field.label = label
rev = "{rev} (<tt>{node|short}</tt>)"
rev.compact = "{rev}"
tags = "{tags % '<span class="tag"> {tag|escape} </span> '}"
summary = "{desc|firstline}"
# custom field can be added by user
git = "{gitnode}"
git:label = "Git"
# TODO: templates for log model (repomodel)
[thg-logtemplates]
rev = "{rev}"
date = "{date|localdate|shortdate}"
API
TODO
GUI
The following widgets can render HTML subset by using QTextDocument
:
-
QLabel
for single revision -
QTextEdit
for scrollable view
Mercurial Extensions
-
hg preparerevset
andprepared(name)
predicate allow us to render the same query in different styles, and retrieve chunks form the large query. -
-T 'thgrevfields(form, style)'
template spec applies the pre-configured template.
Example:
# execute query, count items, and save it as "cslist0"
$ hg preparerevset cslist0 -r 'outgoing()' --count
# retrieve the first 20 items and the last for "prune" dialog in "list" style
$ hg log --config tortoisehg.loadtemplates=True \
> -r 'limit(prepared(cslist0), 20)' -T '{thgrevfields("prune", "list")}'
$ hg log --config tortoisehg.loadtemplates=True \
> -r 'last(prepared(cslist0))' -T '{thgrevfields("prune", "list")}'
Change History
In Mercurial 3.4:
- fix
{get(extras, key)}
- fix
{function()|filter}
In Mercurial 3.5:
In Mercurial 3.6:
-
{localdate(date, "UTC")}
template function
in Mercurial 3.7:
-
limit(set, n, offset)
revset
TODOs
short-term:
- implement prepared revset extension (WIP)
- implement template extension (WIP)
- implement APIs for asynchronous query (WIP)
- add hack for MQ (maybe we'll need new command that feeds patchctxs to templater)
- add hyperlink support
- add incremental fetcher?
long-term:
- add replacement for
csinfo
,cslist
andrevpanel
- rewrite
repomodel
...
unresolved issues:
- How to handle unapplied MQ patches?
- Hyperlinks
- Stylesheets
- Cache ...
Issues to Consider
TODO
annotate:
- #4284 - KeyError on annotate
repomodel:
- #532 - Long operations block UI (Qt)
- #580 - Sorting order in workbench
- #1991 - Highlight parents of merge
- #2038 - Local Time log column should be MY local time
- #2210 - Workbench, reversion list get slow when showing 'Changes' column for large repo
- #4033 - graph: highlight ancestors of selected revision
- #4099 - Updated dynamic tags not updating in GUI (hg-git)
- #4259 - Latest tag distance in revision history
- #4335 - Configure Local Time Column
revdetails/revpanel:
- #1035 - thg file log full changeset description
- #1382 - Log message viewer needs word-wrap
- #1620 - Issue Tracking Named Branch?
- #2642 - Show graft/transplant branch in changeset details panel