Commit Graph

33 Commits

Author SHA1 Message Date
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