Changeset 1675
- Timestamp:
- 12/12/06 18:05:25 (2 years ago)
- Files:
-
- revtreeplugin/0.10/revtree/htdocs/css/revtree.css (modified) (3 diffs)
- revtreeplugin/0.10/revtree/htdocs/js/svgtip.js (modified) (2 diffs)
- revtreeplugin/0.10/revtree/model.py (modified) (4 diffs)
- revtreeplugin/0.10/revtree/svgview.py (modified) (15 diffs)
- revtreeplugin/0.10/revtree/templates/revtree.cs (modified) (3 diffs)
- revtreeplugin/0.10/revtree/web_ui.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
revtreeplugin/0.10/revtree/htdocs/css/revtree.css
r1669 r1675 1 div#settings {2 }3 form#prefs {4 margin-top: 2em;5 }6 div.revtree .tip {7 font: 10px/12px Arial,Helvetica,sans-serif;8 border: solid 1px #666666;9 width: 250px;10 padding: 1px;11 position: absolute;12 z-index: 100;13 visibility: hidden;14 color: #333333;15 top: 20px;16 left: 90px;17 background-color: #ffffcc;18 layer-background-color: #ffffcc;19 }20 21 1 div.revtree div#legend { 22 align: right;2 text-align: right; 23 3 } 24 4 div.revtree div#errormsg { … … 31 11 margin-left: 1ex; 32 12 white-space: nowrap; 33 position: relative;34 13 float: left; 35 14 border-right: solid 1px #333; 36 15 } 37 div#treestyle div {16 #treestyle div { 38 17 display: block; 39 18 } 40 div#options {19 #treeoptions { 41 20 white-space: normal; 42 21 width: 12ex; 43 22 } 44 div#options label {45 margin =top: 0;23 #treeoptions label { 24 margin-top: 0; 46 25 padding-left: 3ex; 47 26 } 48 div#update {27 #treeupdate { 49 28 border-right: none; 50 29 } 30 #settings { 31 /* FIXME */ 32 width: 100%; 33 border-top: 4px solid red; 34 background-color: red; 35 margin-top: 0; 36 margin-left: 0; 37 margin-right: 0; 38 margin-bottom: 10em; 39 } 51 40 #prefs { 52 position: relative;41 margin-top: 2em; 53 42 float: left; 54 43 } 55 44 div.svg { 56 position: relative;57 float: left;45 float: none; 46 margin-left: 4ex; 58 47 } 59 48 div#revtree { … … 111 100 color:#333333; 112 101 } 113 .JT_loader{102 #JT_loader{ 114 103 background-image: url(../images/loader.gif); 115 104 background-repeat: no-repeat; revtreeplugin/0.10/revtree/htdocs/js/svgtip.js
r1669 r1675 81 81 document.getElementsByTagName('body')[0].appendChild(d0); 82 82 83 // netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); 83 84 $('#JT').show(); 84 85 $('#JT_copy').load(url); … … 87 88 function getSvgPosition(objectId) { 88 89 var svg = document.getElementsByTagName('svg')[0]; 89 //alert('position: ' + svg.parentNode.offsetTop);90 90 var anodes = svg.getElementsByTagName('a'); 91 91 var object; revtreeplugin/0.10/revtree/model.py
r1668 r1675 22 22 23 23 class ChangesetEmptyRange(TracError): 24 """Defines a RevTree error (no changeset in the selected range)""" 24 25 def __init__(self, msg=None): 25 26 TracError.__init__(self, "%sNo changeset" \ … … 220 221 # Trac version control 221 222 self._crepos = self.env.get_repository(authname) 222 #self._svnrepos = SubversionRepository(repository_path, None, self.log)223 #self._reposcache = CachedRepository(env.get_db_cnx(), self._svnrepos,224 # None, self.log)225 223 # Dictionnary of changesets 226 224 self._changesets = {} 227 225 # Dictionnary of branches 228 226 self._branches = {} 229 # Lowset revision number230 #self._rev_min = 1231 # Highest revision number232 #self._rev_max = self._proxy.get_youngest_revision()233 227 234 228 def _build_branches(self): … … 287 281 return (node.get_name(), node.rev) 288 282 289 #def get_revisions_by_date(self, dayrange):290 # """Returns a tuple of (min, max) revisions from291 # a date range (oldest, newest)"""292 # current = time.time()293 # mintime = current - (dayrange[0]*86400)294 # maxtime = current - (dayrange[1]*86400)295 # revisions = []296 # for chg in self._changesets.values():297 # if chg.time < mintime:298 # continue299 # if chg.time > maxtime:300 # continue301 # revisions.append(chg.revision)302 # revisions.sort()303 # if not revisions:304 # return (0, 0)305 # if len(revisions) >= 2:306 # return (revisions[0], revisions[-1])307 # return (revisions[0], revisions[0])308 309 283 def build(self, bcre, revrange=None, timerange=None): 310 284 """Builds an internal representation of the repository, which 311 285 is used to generate a graphical view of it""" 286 self._crepos.sync() 312 287 start = 0 313 288 stop = int(time.time()) … … 332 307 raise ChangesetEmptyRange 333 308 vcsort.sort() 334 self.log.debug("SORT %d" % len(vcsort))335 309 self._revrange = (vcsort[0][1].rev,vcsort[-1][1].rev) 336 310 vcsort.reverse() revtreeplugin/0.10/revtree/svgview.py
r1669 r1675 22 22 23 23 UNIT = 25 24 SQRT2=sqrt(2) 25 SQRT3=sqrt(3) 26 27 # FIXME: This should be set in Trac properties, or event better: 28 # as CSS properties 24 29 FONT_NAME = 'Verdana' 25 30 FONT_SIZE = '14pt' 26 SQRT2=sqrt(2) 27 SQRT3=sqrt(3) 28 29 debugw = [] 30 def dbgPt(x,y,c='red',d=5): 31 debugw.append(SVG.circle(x,y,d, 'white', c, '2')) 32 def dbgLn(x1,y1,x2,y2,c='red',w=3): 33 debugw.append(SVG.line(x1,y1,x2,y2,c,w)) 34 def dbgDump(svg): 35 map(svg.addElement, debugw) 31 32 # Debug functions to place debug circles on the SVG graph 33 #debugw = [] 34 #def dbgPt(x,y,c='red',d=5): 35 # debugw.append(SVG.circle(x,y,d, 'white', c, '2')) 36 #def dbgLn(x1,y1,x2,y2,c='red',w=3): 37 # debugw.append(SVG.line(x1,y1,x2,y2,c,w)) 38 #def dbgDump(svg): 39 # map(svg.addElement, debugw) 36 40 37 41 def textwidth(text): … … 46 50 47 51 class SvgColor(object): 52 """Helpers for color management (conversion, generation, ...)""" 48 53 49 54 colormap = { 'black': (0,0,0), … … 133 138 134 139 class SvgBaseChangeset(object): 140 """Base class for graphical changeset/revision nodes 141 This changeset cannot be rendered in the SVG graph""" 135 142 136 143 def __init__(self, parent, revision, position=None): … … 174 181 175 182 def render(self): 176 # debug only177 #w = SVG.circle(self._position[0], self._position[1],178 # 20, 'blue', 'blue', 3)179 #self._parent.svg().addElement(w)180 183 pass 181 184 182 185 183 186 class SvgChangeset(SvgBaseChangeset): 187 """Changeset/revision node""" 184 188 185 189 def __init__(self, parent, changeset): … … 272 276 273 277 class SvgBranchHeader(object): 278 """Branch title""" 274 279 275 280 def __init__(self, parent, title): … … 318 323 319 324 class SvgBranch(object): 320 325 """Branch (set of changesets which whose commits share a common base 326 directory)""" 327 321 328 def __init__(self, parent, branch, style): 322 329 self._parent = parent … … 460 467 461 468 class SvgAxis(object): 462 469 """Simple graphical line between a header and the youngest 470 revision of a branch""" 471 463 472 def __init__(self, parent, head, tail, color='#7f7f7f'): 464 473 self._parent = parent … … 483 492 484 493 class SvgTransition(object): 485 494 """Simple graphical line between two consecutive changesets 495 on the same branch""" 496 486 497 def __init__(self, parent, srcChg, dstChg, color): 487 498 self._parent = parent … … 507 518 508 519 class SvgChangeLink(object): 520 """Deprecated. Set of associated changeset on the same branch""" 509 521 510 522 def __init__(self, parent, srcChg, dstChg, color='#000'): … … 542 554 543 555 class SvgGroup(object): 556 """Graphical group of consecutive changesets within a same branch""" 544 557 545 558 def __init__(self, parent, firstChg, lastChg, color='#fffbdb'): … … 579 592 580 593 class SvgOperation(object): 581 594 """Graphical operation between two changesets of distinct branches 595 (such as a switch/branch creation, a merge operation, ...)""" 596 582 597 def __init__(self, parent, srcChg, dstChg, color='black'): 583 598 self._parent = parent … … 704 719 705 720 class SvgArrows(object): 721 """Arrow headers for graphical links and operations""" 706 722 707 723 def __init__(self, parent): … … 734 750 735 751 class SvgRevtree(object): 736 752 """Main object that represents the revision tree as a SVG graph""" 753 737 754 def __init__(self, env, repos, urlbase): 738 755 """Construct a new SVG revision tree""" … … 877 894 Store every points of an operation path. If the point is already 878 895 marked as used, find another point, looking around the original 879 point for a free slot 880 """ 896 point for a free slot""" 881 897 (x, y) = point 882 898 kx = int(x) … … 916 932 map(lambda b: b.render(), self._svgbranches.values()) 917 933 map(lambda e: e.render(2), self._enhancers) 918 dbgDump(self._svg)934 #dbgDump(self._svg) revtreeplugin/0.10/revtree/templates/revtree.cs
r1669 r1675 7 7 8 8 <h1>Revision Tree</h1> 9 10 <div id="settings"> 11 <form id="prefs" method="get" action=""> 12 <div class="revprops"> 13 <fieldset id="properties"> 14 <legend>Filters</legend> 15 <div class="field"> 16 <label for="branch">Branch</label> 17 <select id="branch" name="branch"><?cs each:br = revtree.branches ?> 18 <option value="<?cs var:br ?>" <?cs if:revtree.branch == br 19 ?>selected="selected"<?cs /if ?>><?cs var:br ?></option><?cs 20 /each ?></select> 21 </div> 22 <div class="field"> 23 <label for="author">Author</label> 24 <select id="author" name="author"><?cs each:auth = revtree.authors ?> 25 <option value="<?cs var:auth ?>" <?cs if:revtree.author == auth 26 ?>selected="selected"<?cs /if ?>><?cs var:auth ?></option><?cs 27 /each ?></select> 28 </div> 29 </fieldset> 30 </div> 31 32 <div class="revprops"> 33 <fieldset id="limits"> 34 <legend>Revisions</legend> 35 <div class="field"> 36 <input type="radio" id="limperiod" name="limits" value="limperiod" <?cs 37 if:revtree.limits == "limperiod" ?> checked="checked"<?cs /if ?>/> 38 <label for="period">Show last </label> 39 <select id="period" name="period"> 40 <?cs each:per = revtree.periods ?><option value="<?cs 41 var:per.value ?>" <?cs if:revtree.period == per.value 42 ?>selected="selected"<?cs /if ?>><?cs var:per.label ?></option> 43 <?cs /each ?></select> 44 </div> 45 <div class="field"> 46 <input type="radio" id="limrev" name="limits" value="limrev" <?cs 47 if:revtree.limits == "limrev" ?> checked="checked"<?cs /if ?>/> 48 <label for="revmin">From </label> 49 <select id="revmin" name="revmin"> 50 <?cs each:rev = revtree.revisions ?><option value="<?cs 51 var:rev ?>" <?cs if:revtree.revmin == rev ?>selected="selected"<?cs 52 /if ?>><?cs var:rev?></option> 53 <?cs /each ?></select> 54 <label for="revmax">up to </label> 55 <select id="revmax" name="revmax"> 56 <?cs each:rev = revtree.revisions ?><option value="<?cs 57 var:rev ?>" <?cs if:revtree.revmax == rev ?>selected="selected"<?cs 58 /if ?>><?cs var:rev ?></option> 59 <?cs /each ?></select> 60 </div> 61 </fieldset> 62 </div> 63 64 <div class="revprops" id="treestyle"> 65 <fieldset> 66 <legend>Style</legend> 67 <div class="field"> 68 <div> 69 <input type="radio" id="compact" name="treestyle" value="compact" <?cs 70 if:revtree.treestyle == "compact" ?> checked="checked"<?cs /if ?>/> 71 <label for="compact">Compact</label> 72 </div> 73 <div> 74 <input type="radio" id="timeline" name="treestyle" value="timeline" <?cs 75 if:revtree.treestyle == "timeline" ?> checked="checked"<?cs /if ?>/> 76 <label for="compact">Timeline</label> 77 </div> 78 </div> 79 </fieldset> 80 </div> 81 82 <div class="revprops" id="treeoptions"> 83 <fieldset> 84 <legend>Options</legend> 85 <div class="field"> 86 <input type="hidden" name="checkbox_hideterm"/> 87 <input type="checkbox" id="hideterm" 88 name="hideterm" <?cs if:revtree.hideterm 89 ?>checked="checked"<?cs /if ?> value="1"/><label for="hideterm">Hide 90 terminated branches</label> 91 </div> 92 </fieldset> 93 </div> 94 95 <div class="revprops" id="treeupdate"> 96 <div class="buttons"> 97 <input type="submit" value="Update"/> 98 </div> 99 </div> 100 </form> 101 </div> 9 102 10 103 <script type="text/javascript"> … … 21 114 </script> 22 115 23 <div id="settings">24 <form id="prefs" method="get" action="">25 <div>26 <div class="revprops">27 <fieldset id="properties">28 <legend>Filters</legend>29 <div class="field">30 <label for="branch">Branch</label>31 <select id="branch" name="branch"><?cs each:br = revtree.branches ?>32 <option value="<?cs var:br ?>" <?cs if:revtree.branch == br33 ?>selected="selected"<?cs /if ?>><?cs var:br ?></option><?cs34 /each ?></select>35 </div>36 <div class="field">37 <label for="author">Author</label>38 <select id="author" name="author"><?cs each:auth = revtree.authors ?>39 <option value="<?cs var:auth ?>" <?cs if:revtree.author == auth40 ?>selected="selected"<?cs /if ?>><?cs var:auth ?></option><?cs41 /each ?></select>42 </div>43 </fieldset>44 </div>45 46 <div class="revprops">47 <fieldset id="limits">48 <legend>Revisions</legend>49 <div class="field">50 <input type="radio" id="limperiod" name="limits" value="limperiod" <?cs51 if:revtree.limits == "limperiod" ?> checked="checked"<?cs /if ?>/>52 <label for="period">Show last </label>53 <select id="period" name="period">54 <?cs each:per = revtree.periods ?><option value="<?cs55 var:per.value ?>" <?cs if:revtree.period == per.value56 ?>selected="selected"<?cs /if ?>><?cs var:per.label ?></option>57 <?cs /each ?></select>58 </div>59 <div class="field">60 <input type="radio" id="limrev" name="limits" value="limrev" <?cs61 if:revtree.limits == "limrev" ?> checked="checked"<?cs /if ?>/>62 <label for="revmin">From </label>63 <select id="revmin" name="revmin">64 <?cs each:rev = revtree.revisions ?><option value="<?cs65 var:rev ?>" <?cs if:revtree.revmin == rev ?>selected="selected"<?cs66 /if ?>><?cs var:rev?></option>67 <?cs /each ?></select>68 <label for="revmax">up to </label>69 <select id="revmax" name="revmax">70 <?cs each:rev = revtree.revisions ?><option value="<?cs71 var:rev ?>" <?cs if:revtree.revmax == rev ?>selected="selected"<?cs72 /if ?>><?cs var:rev ?></option>73 <?cs /each ?></select>74 </div>75 </fieldset>76 </div>77 78 <div class="revprops" id="treestyle">79 <fieldset>80 <legend>Style</legend>81 <div class="field">82 <div>83 <input type="radio" id="compact" name="treestyle" value="compact" <?cs84 if:revtree.treestyle == "compact" ?> checked="checked"<?cs /if ?>/>85 <label for="compact">Compact</label>86 </div>87 <div>88 <input type="radio" id="timeline" name="treestyle" value="timeline" <?cs89 if:revtree.treestyle == "timeline" ?> checked="checked"<?cs /if ?>/>90 <label for="compact">Timeline</label>91 </div>92 </div>93 </fieldset>94 </div>95 96 <div class="revprops" id="options">97 <fieldset id="options">98 <legend>Options</legend>99 <div class="field">100 <input type="hidden" name="checkbox_hideterm"/>101 <input type="checkbox" id="hideterm"102 name="hideterm" <?cs if:revtree.hideterm103 ?>checked="checked"<?cs /if ?> value="1"/><label for="hideterm">Hide104 terminated branches</label>105 </div>106 </fieldset>107 </div>108 109 <div class="revprops" id="update">110 <div class="buttons">111 <input type="submit" value="Update"/>112 </div>113 </div>114 </div>115 </form>116 </div>117 118 116 <?cs if revtree.legend ?> 119 117 <div id="legend"> … … 128 126 <?cs else ?> 129 127 <div class="svg"> 128 <!-- Inline SVG breaks the XHTML 1.0 strict conformance 129 XHTML + SVG + MathML document type does not help ... --> 130 130 <?cs var:revtree.svg.image ?> 131 131 </div> revtreeplugin/0.10/revtree/web_ui.py
r1669 r1675 369 369 370 370 def _select_parameters(self, repos, req, revstore): 371 """ """ 371 """Calculates the revisions/branches/authors to show as selectable 372 properties for the revtree generation""" 372 373 revs = [c for c in repos.changesets()] 373 374 revs.reverse()
