Commit Graph

48 Commits

Author SHA1 Message Date
Yuya Nishihara
452668fc48 graphmod: compute slow revset query once prior to reachableroots (issue4782)
Because revsets query is evaluated lazily, "list(revs)" may take long for
complicated query. So we shouldn't iterate revs many times. This patch is the
easiest workaround for the issue4782. We could introduce more aggressive
caching, but it wouldn't be as fast as the simple baseset operation.

Gregory Szorc said "this makes `hg wip` on my Firefox clone ~4x faster than
3.5.1 (~6.5s to ~1.5s). This is after a regression in @ to ~45s."
2015-09-08 23:00:44 +09:00
Pierre-Yves David
dda8443bfd graphmod: stop building a list out of branchgroupiter
Not only does this defeat the purpose of having `branchgroupiter` an iterable, but
this also makes revs something else than a smartset preventing to use revs.min()
in the call to reachablerevs.
2015-08-21 16:03:25 -07:00
Laurent Charignon
671ccbcb62 revset: remove grandparent by using reachableroots
This patch is part of a series of patches to speed up the computation of
revset.reachableroots by introducing a C implementation. The main motivation
is to speed up smartlog on big repositories. At the end of the series, on our
big repositories the computation of reachableroots is 10-50x faster and
smartlog on is 2x-5x faster.

Before this patch, we had a custom computation for grandparent that was very
close to the idea of reacheablerooots. This patch expresses grandparent with
reachableroots to reduce the amount of code.
2015-06-19 20:28:52 -07:00
Gregory Szorc
145e627f93 graphmod: use absolute_import 2015-08-08 19:18:23 -07:00
Mads Kiilerich
b2b60414f6 spelling: fixes from proofreading of spell checker issues 2015-01-18 02:38:57 +01:00
Augie Fackler
dffa530fe5 graphmod: attempt to clarify documentation of groupbranchiter()
Thanks to Pierre-Yves for checking my cleanups here and helping me
understand the algorithm well enough to help document it.
2014-12-09 09:35:04 -05:00
Augie Fackler
05a78b6693 graphmod: rename graph-topological config to graph-group-branches
The latter suggests what the change is slightly better.
2014-12-08 15:20:28 -05:00
Pierre-Yves David
868b50f41b groupbranchiter: allow callers to select the first branch
Instead of just bootstrapping the algorithm with the first revision we
see, allow callers to pass revs that should be displayed first. All
branches are retained until we can display such revision.

Expected usage is to display the current working copy parent first.
2014-09-04 19:28:17 +02:00
Pierre-Yves David
31b9015754 groupbranchiter: support for non-contiguous revsets
The algorithm now works when some revisions are skipped. We now use "first
included ancestors" instead of just "parent" to link changesets with each other.
2014-09-04 19:05:36 +02:00
Pierre-Yves David
401e3ad848 groubranchhiter: indent most of the inner code
We are going to add an additional layer of indentation to support non-contiguous
revset. We do it in a pure code movement changeset to help the readability of
the next changeset.
2014-11-14 20:08:59 +00:00
Pierre-Yves David
849760925f graphlog: add a way to test the 'groupbranchiter' function
We add an experimental config option to use the topological sorting. I first
tried to hook the 'groupbranchiter' function in the 'sort' revset but this was useless
because graphlog enforces revision number sorting :(

As the goal is to advance on the topological iteration logic, I see this
experimental option as a good way to move forward.

We have to use turn the iterator into a list because the graphlog is apparently
not ready for pure iterator input yet.
2014-11-14 17:37:59 +00:00
Pierre-Yves David
7817904ce3 graphmod: add a function for topological iteration
This changeset introduces a function to perform topological (one branch after
the other) iteration over a set of changesets. This first version has a lot of
limitations, but the approach should be flexible enough to allow many
improvements in the future. This changeset aims to set the first stone more
than providing a complete solution.

The algorithm does not need to know the whole set of nodes involved
before emitting revision. This makes it a good candidate for usage in place
like `hg log` or graphical tools that need a fast first result time.
2014-09-04 18:19:32 +02:00
Pierre-Yves David
fc1793eb9f dagwalker: drop a useless intermediate variable
The variable used to contain revs.set() but as the `.set()` has been removed
it is now useless.
2014-10-08 02:43:51 -07:00
Pierre-Yves David
544d621b98 graphnode: remove usage of set()
All smartset classes have fast lookup, so this function will be removed soon.
2014-10-10 11:27:04 -07:00
Lucas Moscovicz
283e1d99ab graphmod: changed code in dagwalker to use lazy implementations
Used lazy methods when possible.
2014-03-14 08:46:46 -07:00
Bryan O'Sullivan
9937540784 graphmod: don't try to visit nullrev (issue3772) 2013-01-23 00:20:26 -06:00
Patrick Mezard
121450bf01 graphlog: extract ascii drawing code into graphmod 2012-07-11 17:13:39 +02:00
Patrick Mezard
9737893642 hgweb: refactor graph customization javascript
- Avoid flipping lineWidth state around the edge() call, pass it to the
  function instead.
- Pass the line width and color appended to the other parameters instead of in
  a dictionary. The javascript code is simpler, no need to check for all
  containers existence, and the JSON output is smaller.
- Reindent setColor() comments and fix code spacing.
2012-01-22 19:35:26 +07:00
Matt Mackall
38994ac76a graphmod: add config cache
Before, we'd lookup the branch for every edge segment in the entire
graph: extremely expensive. This happened even when no per-branch
settings existed.

Now we define a revision -> config cache function that's LRU-cached
and is a no-op when no configuration exists. Still not terribly fast,
but hopefully only one real branch lookup per revision. This might
degenerate for wide graphs as the LRU is hard-coded to 20 elements.
2012-02-17 13:53:41 -06:00
Matt Mackall
6788faf119 graphmod: rewrite graph config validation
Our goal is not to strictly disallow _invalid_ input, simply disallow _hostile_ input.

Avoid using re
Avoid creating empty dicts when no branch parameters are recognized
2012-02-17 13:53:19 -06:00
Constantine Linnick
73bdfc9ad9 graph: in hgrc specify line color for main branch
You can specify color to visually distinguish main branch (trunk)
on hgweb's graph page. If color specified, all branch heads will share
same color. Settings format is branch_name.color = value, where color
is six hexadecimal digits e.g.:
[graph]
default.color = FF0000
2012-01-22 19:47:03 +07:00
Constantine Linnick
c28ce344f6 graph: in hgrc specify line width for main branch
You can specify width to visually distinguish main branch (trunk)
on hgweb's graph page. Settings format is branch_name.width = value,
where width in px e.g.:
[graph]
default.width = 3
2012-01-22 19:35:26 +07:00
Patrick Mezard
6386b88096 graphmod: correctly emit nodes with more than 2 predecessors
The grandparent() function was returning only the closest predecessor of a
missing parent while it must return all of them to display a correct ancestry
graph.
2011-05-01 15:51:46 +02:00
Patrick Mezard
ea1a2e99d0 graphlog: use a set for inclusion test
This makes a big difference in performance in the special case where all
revisions are being graphed.
2011-04-30 19:42:00 +02:00
Idan Kamara
a4468d58f7 graphmod: restore generator nature of dagwalker
a32a0f72065a introduced the ability to walk the DAG
given arbitrary revisions, but changed the behaviour of
it to return a list of all nodes (and create a changectx
for each one) rather than doing it lazily.

This has a pretty significant impact on performance for large
repositories (tested on CPython repo, with output disabled):

  $ time hg glog

  real	0m2.642s
  user	0m2.560s
  sys	0m0.080s

Before a32a0f72065a:

  $ time hg glog

  real	0m0.143s
  user	0m0.112s
  sys	0m0.032s

And after this fix:

  $ time hg glog

  real	0m0.213s
  user	0m0.184s
  sys	0m0.028s
2011-04-30 15:10:58 +03:00
Alexander Solovyov
0eb3836642 remove unused imports and variables 2011-04-30 13:59:14 +02:00
Alexander Solovyov
f4250e8e9c graphlog: make use of graphmod's revset support 2011-04-23 15:04:15 +02:00
Alexander Solovyov
517dbf068d graphmod: use revsets internally
Thanks for the idea and most of the implementation to Klaus Koch

Backs revisions() and filerevs() with DAG walker which can iterate through
arbitrary list of revisions instead of strict one by one iteration from start to
stop. When a gap occurs in a revisions (i.e. in file log), the next topological
parent within the revset is searched and the connection to it is printed in the
ascii graph.

File graph can draw sometimes more connections than previous version, because
graph is produced according to the revset, not according to a file's filelog.

In case the graph contains several branches where the left parent is null, the
graphs for each are printed sequentially, not in parallel as it was a case
earlier (see for example the graph for README in hg-dev).
2011-03-13 15:53:38 +01:00
Nicolas Dumazet
74d80b6b4f graphmod: safer code when a changeset has two identical parents
While this situation should never under normal use, some real
life repos sometimes contain such changesets (older hg versions,
broken rebases, etc...)

hgweb was displaying an "Internal error" in this case, and graphlog
displayed a redundant branch all the way to null: it does not cost us
much to just ignore this extra parent when constructing the DAG.
2010-11-08 22:45:56 +09:00
Benoit Boissinot
d40d4a3c0e hgweb/graph: edge should be same color as the destination 2010-03-07 17:44:43 +01:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Nicolas Dumazet
a7b35aa08b graphlog: fix output when both a limit and a path are provided
Limit was interpreted as absolute, from the topmost revision, without
counting the number of revisions matching a given file.
Which caused "glog -lN file" to show sometimes less than N csets if
the file was not modified in all of the N previous csets.

glog will now match the behavior of log.
2009-12-11 15:25:33 +09:00
Dirkjan Ochtman
82f6492ad3 graphlog: don't pass filectxs to the templater (issue1896) 2009-11-06 08:27:17 +01:00
Peter Arrenbrecht
fd55ac9c4d graphmod/webcommands: use generic DAG walks
Changes graph() to colorededges(), which operates on the new
generic DAG walks and adds color and edge information needed
by the web graph.

This is in preparation of adding DAG walk filters, like the
linear run collapser in the next patch. The idea is to have
a bunch of changelog walkers that return basic data. Then we
can filter this data. Finally we add edge and formatting info
suitable for the output media we want to target (glog, hgweb).
2009-06-19 13:44:23 +02:00
Peter Arrenbrecht
5eb219567b graphmod: rename a bunch of vars in graph() 2009-05-16 07:12:12 +02:00
Peter Arrenbrecht
e798ecda43 graphmod/graphlog: make dag walks carry data as type, payload 2009-06-19 13:22:32 +02:00
Peter Arrenbrecht
4f16f2b978 graphmod/graphlog: extract nodelistwalk 2009-06-19 13:14:45 +02:00
Peter Arrenbrecht
6b4a9cc835 graphmod/graphlog: move log walks to graphmod 2009-06-19 13:14:01 +02:00
Peter Arrenbrecht
46c6deb9d6 graphmod: code cleanup and doc fix 2009-05-14 17:32:31 +02:00
Nicolas Dumazet
4c31093b61 cmdutil: replace sys.maxint with None as default value in loglimit
Semantically, it is better to use None over any other value when there is
"no value". Using maxint in this context is quite hackish, and is not forward
compatible.
2009-12-14 00:32:29 +09:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Peter Arrenbrecht
bc21361ed2 cleanup: drop unused imports 2009-03-23 13:12:07 +01:00
Dirkjan Ochtman
074cf082f4 hgweb: fix problems with empty repositories 2009-01-04 19:10:42 +01:00
Benoit Boissinot
ea7fe6dacc remove unused variables 2008-10-28 19:25:26 +01:00
Dirkjan Ochtman
d372202ca2 hgweb: let the web graph cope with low revisions/new repositories (issue1293) 2008-09-12 16:15:01 +02:00
Matt Mackall
fbb5127472 use repo[changeid] to get a changectx 2008-06-26 14:35:46 -05:00
Dirkjan Ochtman
4f94568371 add graph page to hgweb 2008-06-18 07:06:41 +02:00