Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

Last modified 13 years ago

#3015 closed enhancement (fixed)

Please display properties in the browser view with the newlines still intact

Reported by: Russell Hind <rhind@…> Owned by: Christian Boos
Priority: normal Milestone: 0.10
Component: version control/browser Version: 0.9.4
Severity: minor Keywords: svn properties
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

svn properties (certainly for svn:ignore and svn:externals) are newline separated list of items, but in the browser view, the new lines are stripped out which makes it harder to read the actual items. Please could the new lines be left in?

For example, svn:externals contain a folder name, then possibly some options, then the url. But when you have multples, the folder name and URL are appearing on the previous line to the corresponding URL because the web browser is just randomly splitting the line at spaces.

Attachments (0)

Change History (7)

comment:1 by Christian Boos, 18 years ago

Keywords: svn properties added
Milestone: 0.10
Owner: changed from Jonas Borgström to Christian Boos
Severity: normalminor
Status: newassigned

Sure.

Index: browser.py
===================================================================
--- browser.py	(revision 3124)
+++ browser.py	(working copy)
@@ -26,7 +26,7 @@
 from trac.mimeview import Mimeview, is_binary, get_mimetype
 from trac.perm import IPermissionRequestor
 from trac.util import sorted
-from trac.util.markup import escape, html
+from trac.util.markup import escape, html, Markup
 from trac.web import IRequestHandler, RequestDone
 from trac.web.chrome import add_link, add_stylesheet, INavigationContributor
 from trac.wiki import wiki_to_html, wiki_to_oneliner, IWikiSyntaxProvider
@@ -103,14 +103,19 @@
         node = get_existing_node(self.env, repos, path, rev_or_latest)
 
         hidden_properties = self.config.getlist('browser', 'hide_properties')
+        properties = []
+        for name, value in node.get_properties().items():
+            if not name in hidden_properties:
+                if value and '\n' in value:
+                    value = Markup('<br />'.join([escape(v) for v in
+                                                  value.split('\n')]))
+                properties.append({'name': name, 'value': value})
 
         req.hdf['title'] = path
         req.hdf['browser'] = {
             'path': path,
             'revision': rev,
-            'props': [{'name': name, 'value': value}
-                      for name, value in node.get_properties().items()
-                      if not name in hidden_properties],
+            'props': properties,
             'href': req.href.browser(path, rev=rev),
             'log_href': req.href.log(path, rev=rev),
             'restr_changeset_href': req.href.changeset(node.rev,

comment:2 by Russell Hind <rhind@…>, 18 years ago

I've applied the patch to my version of trunk (updated now) but it doesn't seem to have had any effect. Could it be anything to do with windows \r\n stupidity? I'm running on WinXP Pro/svn1.3.1/apache-2.0.55/mod_python3.2.8/python-2.3.5

Cheers

Russell

comment:3 by Christian Boos, 18 years ago

In \r\n, you have the \n, so the above code should work too… It's most probably an install issue.

Try inserting some garbage (e.g. force 'value': to be 'Hello World') in order to check if the code change is taken into account.

If this is indeed the case, then post the binary content of the property, e.g.

svn pget svn:externals <the_path> | od -c

comment:4 by Russell Hind <rhind@…>, 18 years ago

Yep, my fault. I'd cleared firfox's disk cache (which I needed to do when you change a style sheet) but hadn't restarted apache. After the restart it works.

If there is more than one line for the property, could all the items be put on new lines? Currently the first item for a property is put after the property name e.g.

  • Property svn:ignore set to debug release
    obj

I think it would be more readable if debug were on a new line too.

I would try this myself, but currently have a real lack of understanding of python code! I learning little bits as am having to convert some python code to C++ in our applications, but don't get on well with their array notation and the lack of a for loops explicitly stated!

Cheers

Russell

comment:5 by Christian Boos, 18 years ago

Resolution: fixed
Status: assignedclosed

Thanks for the feedback. Check r3135.

comment:6 by Russell Hind <rhind@…>, 18 years ago

Looks good.

Thanks

comment:7 by rhind@…, 13 years ago

Cc: rhind@… removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.