Mercurial > hg
view contrib/dirstatenonnormalcheck.py @ 27913:91ac8cb79125 stable
templates: use canvaswidth instead of fixed width for canvas (issue2683)
Before this patch, template files for "graph" web page use fixed width
size "480" for canvas element.
This causes pruned lanes and invisible vertexes, if there are 16 or
more vertical lanes at once. In such case, part of graph in right side
area over 480 is invisible, even though corresponded summary text
blocks are visible correctly.
This limitation isn't reasonable for workflow using many branches at
once (e.g. "one branch per issue" workflow).
There were changes below related to width of canvas:
- 7359cb753a54 (templates: widen the graph canvas (issue2683)),
released as a part of Mercurial 1.8.2
According to the description, this assumed that 15 parallel
branches was enough for ordinary workflow, and bumped width of
canvas up from 224 to 480.
- d490edc71146 (hgweb: make graph data suitable for template usage),
released as a part of Mercurial 2.3
This introduced "canvaswidth" template keyword as a part of
refactoring around graph rendering.
But 'width="480"' of canvas element in template files wasn't
replaced by 'width="{canvaswidth}"' in it (or subsequent one).
This patch uses dynamic value "{canvaswidth}" instead of fixed width
size "480" for canvas element.
This is posted for "stable", because:
- this is re-fixing issue2683
- this is simple enough for stable
- using "{canvaswidth}" doesn't require any additional cost
Calculation of canvaswidth is already implied as a part of "graph"
web command.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 21 Jan 2016 02:42:01 +0900 |
parents | b502138f5faa |
children | 3fd94f603190 |
line wrap: on
line source
# dirstatenonnormalcheck.py - extension to check the consistency of the # dirstate's non-normal map # # For most operations on dirstate, this extensions checks that the nonnormalset # contains the right entries. # It compares the nonnormal file to a nonnormalset built from the map of all # the files in the dirstate to check that they contain the same files. from __future__ import absolute_import from mercurial import ( dirstate, extensions, ) def nonnormalentries(dmap): """Compute nonnormal entries from dirstate's dmap""" res = set() for f, e in dmap.iteritems(): if e[0] != 'n' or e[3] == -1: res.add(f) return res def checkconsistency(ui, orig, dmap, _nonnormalset, label): """Compute nonnormalset from dmap, check that it matches _nonnormalset""" nonnormalcomputedmap = nonnormalentries(dmap) if _nonnormalset != nonnormalcomputedmap: ui.develwarn("%s call to %s\n" % (label, orig)) ui.develwarn("inconsistency in nonnormalset\n") ui.develwarn("[nonnormalset] %s\n" % _nonnormalset) ui.develwarn("[map] %s\n" % nonnormalcomputedmap) def _checkdirstate(orig, self, arg): """Check nonnormal set consistency before and after the call to orig""" checkconsistency(self._ui, orig, self._map, self._nonnormalset, "before") r = orig(self, arg) checkconsistency(self._ui, orig, self._map, self._nonnormalset, "after") return r def extsetup(ui): """Wrap functions modifying dirstate to check nonnormalset consistency""" dirstatecl = dirstate.dirstate devel = ui.configbool('devel', 'all-warnings') paranoid = ui.configbool('experimental', 'nonnormalparanoidcheck') if devel: extensions.wrapfunction(dirstatecl, '_writedirstate', _checkdirstate) if paranoid: # We don't do all these checks when paranoid is disable as it would # make the extension run very slowly on large repos extensions.wrapfunction(dirstatecl, 'normallookup', _checkdirstate) extensions.wrapfunction(dirstatecl, 'otherparent', _checkdirstate) extensions.wrapfunction(dirstatecl, 'normal', _checkdirstate) extensions.wrapfunction(dirstatecl, 'write', _checkdirstate) extensions.wrapfunction(dirstatecl, 'add', _checkdirstate) extensions.wrapfunction(dirstatecl, 'remove', _checkdirstate) extensions.wrapfunction(dirstatecl, 'merge', _checkdirstate) extensions.wrapfunction(dirstatecl, 'drop', _checkdirstate)