-# Copyright (C) 2007-2010 International Business Machines Corporation and Others. All Rights Reserved.
+# Copyright (C) 2007-2012 International Business Machines Corporation and Others. All Rights Reserved.
# Review module.
# TODO: refactor ticket manipulation items into ticketmgr.
voteable_paths = ListOption('icucodetools', 'paths', '/ticket*',
doc='List of URL paths to show reviews on. Globs are supported.')
+ # search for earliest match, and how many segments to include following
+ # trunk
+ # branches/maint/maint-4-8
+ # tags/release-2-0
+ branchList = [['trunk',0],['branches',2],['tags',1]]
+
# IPermissionRequestor methods
def get_permission_actions(self):
return ['ICUREVIEW_VIEW']
req.args['ticket'] = match.group(1)
return True
+ def pathToBranchName(self, path):
+ #return '/'.join(path.split('/')[0:2])
+ windex = None
+ win = None
+ for branch in self.branchList:
+ if(path == branch[0]): # catch changes to just 'trunk'
+ idx = 0
+ else:
+ idx = path.find(branch[0]+'/')
+ if(idx > -1 and (windex == None or windex > idx)):
+ windex = idx
+ win = branch
+ if windex == None:
+ segments = path.split('/')
+ return '/'.join(segments[0:2])
+ else:
+ #print "found %s foll %s @ %d" % (win[0],win[1],windex)
+ segments = path[windex:].split('/')
+ return path[:windex] + ('/'.join(segments[0:win[1]+1])) # use specified # of following segments
+
def changeToRange(self, c_new, change):
# q: (u'trunk/Locale.java', 'file', 'add', None, u'-1') from r3
# q: (u'trunk/util.c', 'file', 'edit', u'trunk/util.c', u'2') from r4
revision['rev'] = tag.a(rev, req.href.changeset(rev))
revision['num'] = rev
revision['comment'] = message #wiki_to_oneliner( message, self.env, db, shorten=False )
+ rbranches = revision['branches'] = []
for chg in chgset.get_changes():
path = chg[0]
if path in files:
item = []
files[path] = item;
item.append(self.changeToRange(rev,chg))
+ branch_name = self.pathToBranchName(path)
+ if branch_name not in rbranches:
+ rbranches.append(branch_name)
revisions.append(revision)
data['revisions'] = revisions
sera = sera+1
file_data = {}
file_data['name'] = Markup('<a href="%s">%s</a>' % (req.href.browser(file),file))
- branch_name = '/'.join(file.split('/')[0:2])
+ branch_name = self.pathToBranchName(file)
#print "branch is: (%s)" % (branch_name)
branches_data = branches.get(branch_name, {})
files_data = branches_data.get('files',[])
branches_data['len'] = len(files_data)
branches_data['name'] = branch_name
branches[branch_name] = branches_data
- #data['files'] = files_data
- #data['branches'] = branches
# .. convert dict to array.
branch_list = []
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
-# Copyright (C) 2007-2010 IBM and Others. All Rights Reserved
+# Copyright (C) 2007-2012 IBM and Others. All Rights Reserved
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
<py:if test="revcount">
-<h2>${revcount} Changesets</h2>
-<ul>
-<py:for each="rev in revisions">
- <li><a href="${href.changeset(rev.num)}">r${rev.num}</a> — ${rev.comment}</li>
-</py:for>
-</ul>
-
+ <h2>${revcount} Changesets</h2>
+ <table class='icureview'>
+ <thead>
+ <tr>
+ <th>r</th>
+ <th>section(s)</th>
+ <th>comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <py:for each="rev in revisions">
+ <tr>
+ <th>
+ <a href="${href.changeset(rev.num)}">r${rev.num}</a>
+ </th>
+ <td>
+ <!-- sections -->
+ <py:for each="branch in rev.branches">
+ <b>
+ <a href="#${branch}">${branch}</a>
+ </b>
+ </py:for>
+ </td>
+ <td>
+ ${rev.comment}
+ </td>
+ </tr>
+ </py:for>
+ </tbody>
+ </table>
+
<py:if test="branchcount > 1">
<h2>Files</h2>
<h3>Jump to Sections</h3>