[PATCH] Draw default branch on graph with bold line
Matt Mackall
mpm at selenic.com
Thu Jan 5 21:38:16 CST 2012
On Fri, 2012-01-06 at 09:17 +0600, Constantine wrote:
> # HG changeset patch
> # User Constantine Linnick <theaspect at gmail.com>
> # Date 1325818775 -25200
> # Node ID 3bc9c187e173544a33080eafb9372bc9bef229d0
> # Parent 371cff9610cdf6d6a7e1a6238ce75441b8107f03
> Draw default branch on graph with bold line
See ContributingChanges on the wiki for how to write summaries.
> diff -r 371cff9610cd -r 3bc9c187e173 mercurial/graphmod.py
> --- a/mercurial/graphmod.py Tue Jan 03 17:13:03 2012 -0600
> +++ b/mercurial/graphmod.py Fri Jan 06 09:59:35 2012 +0700
> @@ -16,7 +16,6 @@
> context of the graph returned. Type is a constant specifying the node type.
> Data depends on type.
> """
> -
Don't change anything unrelated to $SUMMARY, please. No bug fixes, no
spelling fixes, no coding style fixes, no whitespace fiddling, nothing.
> from mercurial.node import nullrev
>
> CHANGESET = 'C'
> @@ -67,7 +66,7 @@
> parents = set([p.rev() for p in ctx.parents() if p.node() in
> include])
> yield (ctx.rev(), CHANGESET, ctx, sorted(parents))
>
> -def colored(dag):
> +def colored(dag,repo):
Missing space. This fails check-code, which means your code is untested.
> """annotates a DAG with colored edge information
>
> For each DAG node this function emits tuples::
> @@ -83,6 +82,11 @@
> seen = []
> colors = {}
> newcolor = 1
> + defaults = {}
> +
> + for (branch, style) in repo.ui.configitems('graph'):
No parens for unpacking tuples, please..
> + defaults[branch] = style.split()
> +
> for (cur, type, data, parents) in dag:
..even if someone else nearby is doing it wrong too.
>
> # Compute seen and next
> @@ -111,10 +115,10 @@
> edges = []
> for ecol, eid in enumerate(seen):
> if eid in next:
> - edges.append((ecol, next.index(eid), colors[eid]))
> + edges.append((ecol, next.index(eid), colors[eid],
> defaults[repo[eid].branch()] if defaults.has_key(repo[eid].branch()) else
> None))
Line to long. if/else syntax not available in Py2.4.
> elif eid == cur:
> for p in parents:
> - edges.append((ecol, next.index(p), color))
> + edges.append((ecol, next.index(p), color,
> defaults[repo[p].branch()] if defaults.has_key(repo[eid].branch()) else
> None))
>
> # Yield and move on
> yield (cur, type, data, (col, color), edges)
> diff -r 371cff9610cd -r 3bc9c187e173 mercurial/help/config.txt
> --- a/mercurial/help/config.txt Tue Jan 03 17:13:03 2012 -0600
> +++ b/mercurial/help/config.txt Fri Jan 06 09:59:35 2012 +0700
> @@ -534,6 +534,23 @@
> option ensures that the on-disk format of newly created
> repositories will be compatible with Mercurial before version 1.7.
>
> +``graph``
> +"""""""""
> +
> +This section specifies branch names which will be enbolden on graph
I think you meant "emboldened", but I don't think that's the ideal usage
here.
> +to visually distinguish "main branch" or trunk in central repository
> +graph.
> +
> +Format branch_name = number, where number is width in px. If width
> +is not specified, it will be 3px width.
> +
> +Example::
> + [graph]
> + default = 2px
> + # graph line will be 3px width
> + stable =
The moment anyone sees this, they'll want to set colors too, so I'll
need to see a plan for that syntax before I can accept this.
> +
> +
> ``merge-patterns``
> """"""""""""""""""
>
> diff -r 371cff9610cd -r 3bc9c187e173 mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py Tue Jan 03 17:13:03 2012 -0600
> +++ b/mercurial/hgweb/webcommands.py Fri Jan 06 09:59:35 2012 +0700
> @@ -770,7 +770,7 @@
> startrev = uprev
>
> dag = graphmod.dagwalker(web.repo, range(startrev, downrev - 1, -1))
> - tree = list(graphmod.colored(dag))
> + tree = list(graphmod.colored(dag,web.repo))
Missing space.
> canvasheight = (len(tree) + 1) * bg_height - 27
> data = []
> for (id, type, ctx, vtx, edges) in tree:
> diff -r 371cff9610cd -r 3bc9c187e173 mercurial/templates/static/mercurial.js
> --- a/mercurial/templates/static/mercurial.js Tue Jan 03 17:13:03 2012
> -0600
> +++ b/mercurial/templates/static/mercurial.js Fri Jan 06 09:59:35 2012
> +0700
> @@ -113,8 +113,13 @@
> x1 = this.cell[0] + this.box_size * end + this.box_size /
> 2;
> y1 = this.bg[1] + this.bg_height / 2;
>
> - this.edge(x0, y0, x1, y1, color);
> -
> + if(line[3]){
> + this.ctx.lineWidth = line[3][0] ? line[3][0] : 3;
> + this.edge(x0, y0, x1, y1, color);
> + this.ctx.lineWidth = 1;
> + }else{
> + this.edge(x0, y0, x1, y1, color);
> + }
> }
>
> // Draw the revision node in the right column
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list