sapling/fastannotate
Jun Wu a3dc8b960d fastannotate: support replacing fctx.annotate directly
Summary:
Previously, I have performance concern about the signature of
`fctx.annotate`: it returns fctxs, not ideal for performance since my
initial goal is to get rid of reading revlogs in the best case. And letting
the low-level `fctx.annotate` have some side effects writing to the disk is
not that pretty.

Because of that, fastannotate had re-invent part of the formatter (also
optimized for performance somehow), and still cannot support all the
features the original annotate supports, namely, templates.

Now it makes sense to just replace `fctx.annotate` with a sub-optimal
implementation, just for the flexibility of the template support of the
original annotate command. We can use a "fake" or "lazy" fctx object to
minimal the performance impact when people only need to print changeset
nodes and line numbers - in which case we don't read revlog.

Actually, the hgweb support already did a similar thing - converting
fastannotate output to annotate output. So we can reuse some code.

The next planned steps are:

  - Make the original "annotate" command aware of fastannotate protocol, do
    the pre-download stuff (downloading cache files at `fctx.annotate` is
    possible but inefficient because of not being batched).
  - "fastannotate" command remains a separated command optimized for perf
    and provides extra features like "--deleted".

Because of the plan, the "commands" option does not make much sense -
"fastannotate" command will not replace "annotate" directly thus dropped
from the config interface. A new "modes" config option is added to control
how fastannotate works.

Test Plan: Modified existing tests

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4238998

Signature: t1:4238998:1480447679:c48e0e565663c086293265e104d9cf414d913aa7
2016-11-29 11:51:08 +00:00
..
__init__.py fastannotate: support replacing fctx.annotate directly 2016-11-29 11:51:08 +00:00
commands.py fastannotate: deal with corrupted files gracefully 2016-11-25 19:49:13 +00:00
context.py fastannotate: support replacing fctx.annotate directly 2016-11-29 11:51:08 +00:00
error.py fastannotate: move exception classes to error.py 2016-09-08 14:47:49 +01:00
formatter.py fastannotate: support -r wdir() 2016-10-21 20:50:37 +01:00
protocol.py fastannotate: fix D4237855 2016-11-29 13:57:44 +00:00
revmap.py fastannotate: add a method to quickly get the last node of the revmap 2016-10-29 19:19:18 +01:00
support.py fastannotate: support replacing fctx.annotate directly 2016-11-29 11:51:08 +00:00