Edgewall Software
Modify

Opened 21 years ago

Closed 21 years ago

Last modified 18 years ago

#277 closed defect (fixed)

Sort by name when browsing svn filesystem incorrect

Reported by: pw@… Owned by: Jonas Borgström
Priority: normal Milestone: 0.7
Component: version control/browser Version: 0.6.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

The way a sort is done in Browser.py causes the display order of names in the view to be inconsistent with normal python string order, can be seen at http://projects.edgewall.com/trac/browser/tags/ where 0.6 is listed after 0.6.1.

The following patch fixes this by stripping the trailing / from the name before doing the comparison in the sort. May not be the best way to do it but gives the desired results.

—-Browser.py 2004-04-22 09:09:36.000000000 -0400 +++ ../../../python2.3/site-packages/trac/Browser.py 2004-04-22 09:12:51.000000000 -0400 @@ -144,9 +144,9 @@

elif order == 'Date':

info.sort(lambda y, x: cmp(xdate_seconds, ydate_seconds))

elif order == 'Name':

  • info.sort(lambda y, x: cmp(xname.rstrip('/'), yname.rstrip('/')))

+ info.sort(lambda y, x: cmp(xname, yname))

else:

  • info.sort(lambda x, y: cmp(xname.rstrip('/'), yname.rstrip('/')))

+ info.sort(lambda x, y: cmp(xname, yname))

# Always put directories before files info.sort(lambda x, y: cmp(yis_dir, xis_dir))

Attachments (0)

Change History (6)

comment:1 by pw@…, 21 years ago

Sorry about the formatting…

--- Browser.py  2004-04-22 09:09:36.000000000 -0400
+++ ../../../python2.3/site-packages/trac/Browser.py    2004-04-22 09:12:51.000000000 -0400
@@ -144,9 +144,9 @@
         elif order == 'Date':
             info.sort(lambda y, x: cmp(x['date_seconds'], y['date_seconds']))
         elif order == 'Name':
-            info.sort(lambda y, x: cmp(x['name'].rstrip('/'), y['name'].rstrip('/')))
+            info.sort(lambda y, x: cmp(x['name'], y['name']))
         else:
-            info.sort(lambda x, y: cmp(x['name'].rstrip('/'), y['name'].rstrip('/')))
+            info.sort(lambda x, y: cmp(x['name'], y['name']))
             
         # Always put directories before files
         info.sort(lambda x, y: cmp(y['is_dir'], x['is_dir']))

comment:2 by Jonas Borgström, 21 years ago

Milestone: 0.6.2
Status: newassigned

Thanks, I'll apply this patch later

comment:3 by Jonas Borgström, 21 years ago

Milestone: 0.6.20.7
Resolution: fixed
Status: assignedclosed

Fixed in [448]. But only in trunk.

comment:4 by anonymous, 18 years ago

Priority: normalhighest

comment:5 by Christian Boos, 18 years ago

Description: modified (diff)
Priority: highestnormal

This is not a test system.

comment:6 by Christian Boos, 18 years ago

Hm… I don't remember having changed the description… hope it's not a bug.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström 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.