From: Steven R. Loomis Date: Tue, 21 Feb 2012 19:56:42 +0000 (+0000) Subject: ICU-8988 checkin for v0.12 - merge X-Git-Tag: milestone-59-0-1~4003 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0fdb2f39ee1ea7a2878b56798e1ad6ccc10cdef;p=icu ICU-8988 checkin for v0.12 - merge X-SVN-Rev: 31474 --- diff --git a/tools/trac/IcuCodeTools/0.12/icucodetools/review.py b/tools/trac/IcuCodeTools/0.12/icucodetools/review.py index 9cbf6499730..f3d1110d3af 100755 --- a/tools/trac/IcuCodeTools/0.12/icucodetools/review.py +++ b/tools/trac/IcuCodeTools/0.12/icucodetools/review.py @@ -1,4 +1,4 @@ -# 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. @@ -32,6 +32,12 @@ class ReviewModule(Component): 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'] @@ -99,6 +105,26 @@ class ReviewModule(Component): 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 @@ -210,6 +236,7 @@ class ReviewModule(Component): 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: @@ -218,6 +245,9 @@ class ReviewModule(Component): 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 @@ -253,7 +283,7 @@ class ReviewModule(Component): sera = sera+1 file_data = {} file_data['name'] = Markup('%s' % (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',[]) @@ -279,8 +309,6 @@ class ReviewModule(Component): 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 = [] diff --git a/tools/trac/IcuCodeTools/0.12/icucodetools/templates/review.html b/tools/trac/IcuCodeTools/0.12/icucodetools/templates/review.html index d86205e57b5..49219f8a1fa 100644 --- a/tools/trac/IcuCodeTools/0.12/icucodetools/templates/review.html +++ b/tools/trac/IcuCodeTools/0.12/icucodetools/templates/review.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -

${revcount} Changesets

- - +

${revcount} Changesets

+ + + + + + + + + + + + + + + + + +
rsection(s)comment
+ r${rev.num} + + + + + ${branch} + + + + ${rev.comment} +
+

Files

Jump to Sections