Edgewall Software

Ticket #1601 (closed enhancement: fixed)

Opened 4 years ago

Last modified 2 years ago

custom SVN properties in "browse source" section

Reported by: oliver@… Owned by: cboos
Priority: normal Milestone: 0.11
Component: version control/browser Version: 0.8.1
Severity: normal Keywords: SVN property, browse source
Cc: pn@…

Description

It would be nice to have the possibility to define custom SVN properties which has to be shown in the "browse source" section. For example I want to define a custom SVN property for the build system which has to be shown in the "browse source" section. The configuration of the SVN properties to be shown in the "browse source" could be part of the trac.ini configuration file.

This could be used for the new SVN 1.2 locking functionality too (svn:needs-lock SVN property).

Attachments

Change History

Changed 4 years ago by mgood

  • severity changed from normal to enhancement

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • milestone 0.9 deleted

I'm interested in this one.

Configuration syntax could be similar to the one used for TracTicketsCustomFields

[browser-custom]

svn:executable = bool
svn:executable.order = 1
svn:executable.label = Exe
svn:executable.title = Executable bit

svn:needs-lock = bool
svn:needs-lock.order = 2
svn:needs-lock.label = L
svn:needs-lock.title = Locking Needed

trac:comment = wiki
trac:comment.order = 3
trac:comment.label = Comment
trac:comment.title = Short description for the path
...
  • A bool property would be rendered with a checkmark if its content is not empty,
  • A wiki property can contain arbitrary wiki markup
  • A text property renders as plain text

Even better, the types could be extensible, so that the rendering method could be adapted to each content. E.g.

class IPropertyRenderer(Interface):
  def get_property_renderers(self):
    """Return a list of (property_type,property_handler) pairs.

    `property_type` is the type associated to a property in the TracIni.

    `property_handler` is a method taking `(req,pname,pvalue)` as
    arguments and which returns some HTML for displaying the property's value
    """

The req argument could be used to adapt the rendering to the context (e.g. an image render could display a small size picture for the browser and a full size image for the changeset view...)

Changed 3 years ago by cboos

  • milestone set to 1.0

Note that property renderers could also be used for fixing #1896:

[browser-custom]
svk:merge = hidden
class HiddenPropertyRenderer(Component):
  implements IPropertyRenderer

  def get_property_renderers(self):
    return ('hidden', self.render)

  def render(self,req,pname,pvalue):
    return ''

Changed 3 years ago by anonymous

I think it would be very useful to be able to show properties in general, and not just the ones listed in the ini file. Of course some protection is needed if a non-printable value is set

Also showing revision properties for changesets is very useful too. For our development we are looking at applying a code-review-log to the revision properties, so we can later see the comments of the code review.

Changed 3 years ago by mgood

to anonymous: In the trunk SVN properties are already displayed if they're available. This ticket is about providing a way to display certain properties in a more descriptive manner. The default behavior would be to display the available properties as plain-text if not otherwise specified.

Revision properties are an interesting suggestion though.

Changed 3 years ago by cboos

  • status changed from assigned to new

(changing the status, as I've not actually started to work on that yet)

Changed 3 years ago by cboos

  • milestone changed from 1.0 to 0.11

Changed 2 years ago by cboos

  • status changed from new to assigned

I've started to work on this one: source:sandbox/property-renderers-tmp

So far, this addresses the #2340 issue and #3002. I plan to rework #2545 as well to use the IPropertyRenderer. Finally, I'll add support for displaying properties in columns, as originally requested in this ticket.

Changed 2 years ago by anonymous

  • cc pn@… added

Changed 2 years ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Implemented in r4653 (IPropertyRenderer). See also r4654 for an example (support for svn:externals and svn:needs-lock properties).

There are two built-in property renderers. The first, DefaultPropertyRenderer, simply checks for the properties listed in the [browser] hide_properties configuration entry, and will render as text any property not listed there. Multi-lines properties will be correctly rendered.

The second, WikiPropertyRenderer, checks for properties listed in either the [browser] wiki_properties or the [browser] oneliner_properties configuration entries, and will wiki format the property, either as html or as single line output, respectively.

Add/Change #1601 (custom SVN properties in "browse source" section)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.