# # # patch "tracvc/mtn/backend.py" # from [a33b8861f9b69e4070166e3351a3962d5aa99d20] # to [35c9ba8f6a4795f433d9b8588c1945f41ee9e91e] # ============================================================ --- tracvc/mtn/backend.py a33b8861f9b69e4070166e3351a3962d5aa99d20 +++ tracvc/mtn/backend.py 35c9ba8f6a4795f433d9b8588c1945f41ee9e91e @@ -38,6 +38,12 @@ import re from tracvc.mtn.util import get_oldpath, get_parent import re +try: + from trac.versioncontrol.web_ui import IPropertyRenderer + has_property_renderer = True +except ImportError: + has_property_renderer = False + DATE_RULE = re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}') REVID_RULE = re.compile(r'^[0-9a-f]{40}$') @@ -479,7 +485,6 @@ class MonotoneChangeset(Changeset): """ def __init__(self, mtn, rev, revpropspec = None): - self.certs = mtn.certs(rev) self.messages = self.certs.get('changelog', ['-']) self.authors = self.certs.get('author', ['-']) @@ -487,12 +492,17 @@ class MonotoneChangeset(Changeset): self.branches = self.certs.get('branch', []) self.tags = self.certs.get('tag', []) - # always pick the first - message = self.messages[0] - author = self.authors[0] + # multiple dates not supported, so pick the first date date = self.dates[0] - + + # Trac doesn't support multiple authors + author = ', '.join(self.authors) + + # concatenate the commit messages + message = '\n----\n'.join(self.messages) + Changeset.__init__(self, rev, message, author, date) + self.mtn = mtn self.revpropspec = revpropspec or {} @@ -532,36 +542,44 @@ class MonotoneChangeset(Changeset): oldpath = get_oldpath(path, changeset.renamed) yield path, Node.FILE, Changeset.EDIT, oldpath, oldrev - def get_properties(self): - """ - Generator that provides additional metadata for this - changeset. - - Each additional property is a 4 element tuple: - * `name` is the name of the property, - * `text` its value - * `wikiflag` indicates whether the `text` should be - interpreted as wiki text or not - * `htmlclass` enables to attach special formatting to the - displayed property, e.g. `'author'`, `'time'`, `'message'` or - `'changeset'`. - """ - for author in self.authors[1:]: - yield('+Author', author, True, 'author') - # fixme: print additional dates? - for parent in self.mtn.parents(self.rev): - yield('Parent', '[cset:%s]' % parent, True, 'changeset') - for child in self.mtn.children(self.rev): - yield('Child', '[cset:%s]' % child, True, 'changeset') - for branch in self.branches: - #yield('Branch', '[branch:%s]' % branch, True, 'changeset') - yield('Branch', branch, False, 'changeset') - for tag in self.tags: - yield('Tag', '[revtag:%s]' % tag, True, 'changeset') - for message in self.messages[1:]: - yield('+Message', message, True, 'message') + if has_property_renderer: + def get_properties(self): + properties = {} + properties['Parent'] = ', '.join(self.mtn.parents(self.rev)) + properties['Child'] = ', '.join(self.mtn.children(self.rev)) + properties['Branch'] = ', '.join(self.branches) + properties['Tag'] = ', '.join(self.tags) + # FIXME: add user-defined revision properties + return properties + else: # legacy + def get_properties(self): + """ + Generator that provides additional metadata for this + changeset. + + Each additional property is a 4 element tuple: + * `name` is the name of the property, + * `text` its value + * `wikiflag` indicates whether the `text` should be + interpreted as wiki text or not + * `htmlclass` enables to attach special formatting to the + displayed property, e.g. `'author'`, `'time'`, `'message'` or + `'changeset'`. + """ + # multiple authors and messages are concatenated, + # additional dates are not printed + for parent in self.mtn.parents(self.rev): + yield('Parent', '[cset:%s]' % parent, True, 'changeset') + for child in self.mtn.children(self.rev): + yield('Child', '[cset:%s]' % child, True, 'changeset') + for branch in self.branches: + #yield('Branch', '[branch:%s]' % branch, True, 'changeset') + yield('Branch', branch, False, 'changeset') + for tag in self.tags: + yield('Tag', '[revtag:%s]' % tag, True, 'changeset') + + # user-defined revision properties to be displayed + for cert, spec in self.revpropspec.iteritems(): + for certvalue in self.certs.get(cert, []): + yield(spec[0], spec[1] % certvalue, spec[2], spec[3]) - # user-defined revision properties to be displayed - for cert, spec in self.revpropspec.iteritems(): - for certvalue in self.certs.get(cert, []): - yield(spec[0], spec[1] % certvalue, spec[2], spec[3])