Sorta kinda revert my changes from Feb. 1 2005, wherein I stopped
grouping directories in the directory view. Now, make that behavior optional (though, the default), but also fix it so that the directory group itself is internally sorted by the current sort key. This more accurately mimics the likes of the Windows Explorer. * viewcvs/viewcvs.conf.dist (sort_group_dirs): New option. * viewcvs/lib/config.py (Config.set_defaults): Set default value for sort_group_dirs. * viewcvs/lib/viewcvs.py (file_sort_cmp): If grouping directories, sorts dirs higher than files. Otherwise, use normal sorting rules. * viewcvs/website/upgrading.html Note the new option. git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1047 8cb11bc2-c004-0410-86c3-e597b4017df7remotes/tags/1.0.0-rc1
parent
bbd4c762cb
commit
874e0be23b
|
@ -186,6 +186,7 @@ class Config:
|
|||
|
||||
self.options.root_as_url_component = 0
|
||||
self.options.sort_by = 'file'
|
||||
self.options.sort_group_dirs = 1
|
||||
self.options.hide_attic = 1
|
||||
self.options.log_sort = 'date'
|
||||
self.options.diff_format = 'h'
|
||||
|
|
|
@ -1396,21 +1396,25 @@ def prepare_hidden_values(params):
|
|||
|
||||
def sort_file_data(file_data, sortdir, sortby):
|
||||
def file_sort_cmp(file1, file2, sortby=sortby):
|
||||
if sortby == 'file':
|
||||
if file1.kind == vclib.DIR: # is_directory
|
||||
# if we're grouping directories together, sorting is pretty
|
||||
# simple. a directory sorts "higher" than a non-directory, and
|
||||
# two directories are sorted as normal.
|
||||
if cfg.options.sort_group_dirs:
|
||||
if file1.kind == vclib.DIR:
|
||||
if file2.kind == vclib.DIR:
|
||||
# both are directories. sort on name.
|
||||
return cmp(file1.name, file2.name)
|
||||
# file1 is a directory, it sorts first.
|
||||
return -1
|
||||
if file2.kind == vclib.DIR:
|
||||
# two directories, no special handling.
|
||||
pass
|
||||
else:
|
||||
# file1 is a directory, it sorts first.
|
||||
return -1
|
||||
elif file2.kind == vclib.DIR:
|
||||
# file2 is a directory, it sorts first.
|
||||
return 1
|
||||
|
||||
# we should have data on these. if not, then it is because we requested
|
||||
# a specific tag and that tag is not present on the file.
|
||||
if file1.rev is not None and file2.rev is not None:
|
||||
# both are files, sort according to sortby
|
||||
# sort according to sortby
|
||||
if sortby == 'rev':
|
||||
return revcmp(file1.rev, file2.rev)
|
||||
elif sortby == 'date':
|
||||
|
|
|
@ -296,6 +296,11 @@ generate_etags = 1
|
|||
# log Sort by log message
|
||||
sort_by = file
|
||||
|
||||
# sort_group_dirs: Group directories when sorting
|
||||
# 1 Group directories together
|
||||
# 0 No grouping -- sort directories as any other item would be sorted
|
||||
sort_group_dirs = 1
|
||||
|
||||
# hide_attic: Hide or show the contents of the Attic subdirectory
|
||||
# 1 Hide dead files inside Attic subdir
|
||||
# 0 Show the files which are inside the Attic subdir
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
<li>options/http_expiration_time</li>
|
||||
<li>options/generate_etags</li>
|
||||
<li>options/root_as_url_component</li>
|
||||
<li>options/sort_group_dirs</li>
|
||||
<li>options/use_pagesize</li>
|
||||
<li>options/use_localtime</li>
|
||||
<li>options/cross_copies</li>
|
||||
|
|
Loading…
Reference in New Issue