Size: 4740
Comment:
|
Size: 4911
Comment: make mention of 'not distributed with Mercurial'
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
'''This extension is not distributed with Mercurial.''' |
|
Line 15: | Line 17: |
This extension works with Mercurial 0.9.3(and may be later). | This extension which works with Mercurial 0.9.3(and may be later) can be found at http://www.lares.dti.ne.jp/~foozy/fujiguruma/scm/graphviz.py . |
Line 171: | Line 174: |
---- CategoryExtension |
Graphviz extension
This extension is not distributed with Mercurial.
Author: Katsunori FUJIWARA
Overview
This extension generates DOT language (of [http://www.graphviz.org/ Graphviz]) source to visualize changeset tree.
Graphviz allows you to get not only image(e.g. *.jpg) files, but also client side image map. So you can get HTML page which cooperates with hg serve.
This extension which works with Mercurial 0.9.3(and may be later) can be found at http://www.lares.dti.ne.jp/~foozy/fujiguruma/scm/graphviz.py .
Configuration
This extension is enabled by adding the following lines to your configuration file (hgrc), if you place graphviz.py in the directory where your python knows:
[extensions] graphviz =
Otherwise:
[extensions] graphviz = /path/to/graphviz.py
Usage
hg graphviz [OPTIONS] [limit-spec ...]
Without limit-spec, graphviz recognizes all changesets as renderring target.
You can limit target changesets by revision range (see -r option) or datetime range(see -d option).
For revision range, you can use any of 'revision number', 'relative number to tip' 'short changeset ID', 'long changeset ID' or 'tag name'.
For datetime range, you should use XML Schema dateTime format, known as YYYY-MM-DDThh:mm:ss(middle T should be exactly T). But it is not so strongly restricted that you can specify 2007-99-99T99:99:99, for example.
limit-spec should be in one of three format.
'Start,End' format limits target changesets to ones between 'Start' and 'End'.
'Start,' format limits target changesets to ones after 'Start'.
',End' format limits target changesets to ones before 'End'.
ATTENTION: End is treated as inclusive, so you should specify 2007-12-31T24:00:00(or such one) to ignore changesets created after 2007, for example.
graphviz recognizes following options.
-r --revision use revision to limit targets(default) -d --datetime use datetime to limit targets -u --urlbase url base for client side image map -a --aliases file with user name aliases -f --format format of changeset label (default: r) --hook hook module to render node attribute
Label formatting
You can specify the format to render label for node corresponded to changeset in visualized graph.
Format string for -f option should consists of following characters.
- u: username(may be aliased)
- U: username
- r: revision number
- s: short-form changeset hash
- h: changeset hash
- d: datetime of changeset
- t: first line of changeset description text
For example, -f rUd causes renderring label 123/who committed <mail@address>/2007-01-01T00:00:00.
User name aliasing
To reduce label length when username is used as part of it, you can specify alias configuration file. This file should consists lines in the following format, or lines which start with '#' as comment.
AliasName=ActualName
Alias conversion is enabled when you use u(small u) as label format.
Client side image map
For example, you can get HTML page imagemap.html, which cooperates with hg serve running at local host port 8000, by following procedure.
% hg graphviz ... -u http://localhost:8000 ... > imagemap.dot % dot -Tjpg -o imagemap.jpg imagemap.dot % cat <<END > imagemap.html <html> <head><title>Changeset graph between .... </title></head> <body> <image src="imagemap.jpg" usemap="_anonymous_0"> END % dot -Tcmapx imagemap.dot >> imagemap.html % cat <<END >> imagemap.html </body> </html> END
Renderring customize
Please specify module name by --hook option, if you want to customize attribute of 'node'. Such module should have the function definition shown below(name of function should be attrhook exactlly):
def attrhook(repository, revision, node, changes):
Arguments are:
repository: to which target revision belongs
revision: revision number
node: gotten by repository.lookup(revision)
changes: gotten by repository.changelog.rev(node).
Non empty string returned by attrhook is joinned to attribute of 'node', so you can highlight 'node's corresponded to changesets which certain use made by code shown below, for example.
def attrhook(repository, revision, node, changes): return ((changes[1] == 'someone highlighted') and 'style = "filled", color = "black", fontcolor = "white"' or None)