[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] [ViewMTN] Sorting directories before files
From: |
Will Thompson |
Subject: |
[Monotone-devel] [ViewMTN] Sorting directories before files |
Date: |
Wed, 12 Mar 2008 17:36:48 +0000 |
User-agent: |
Mozilla-Thunderbird 2.0.0.9 (X11/20080110) |
Hi,
The attached trivial patch to ViewMTN sorts directories before files
when browsing a revision, which seems useful.
It relies on python believing that "dir" < "file", and hence that
("dir", x) sorts before ("file", y); there's a comment to this effect.
Thanks,
--
Will – not subscribed to this list; please CC me if you reply.
#
# old_revision [ff6f92608b076dabc1da2f37b4aa326f47a8a7eb]
#
# patch "handlers.py"
# from [1de08d5626f44e62341a85effcad4ce618264d95]
# to [808a9a3128487df75a7f4a66a93611d7917e5f90]
#
============================================================
--- handlers.py 1de08d5626f44e62341a85effcad4ce618264d95
+++ handlers.py 808a9a3128487df75a7f4a66a93611d7917e5f90
@@ -614,8 +618,11 @@ class RevisionBrowse(RevisionPage):
if not certinfo.has_key(revision):
certinfo[revision] = _get_certinfo(revision)
return certinfo[revision]
-
- for stanza_type, this_path in entry_iter:
+
+ # entry_iter yields tuples (type, name) where type == "dir" or type
+ # == "file". "dir" < "file", so sorting the list will sort
+ # directories before files, and otherwise sort by name. How handy!
+ for stanza_type, this_path in sorted(entry_iter):
# determine the most recent of the content marks
content_marks = [t[1] for t in
ctxt.ops.get_content_changed(revision, this_path)]
for mark in content_marks:
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-devel] [ViewMTN] Sorting directories before files,
Will Thompson <=