1. Ryan Ollos
  2. MoreWikiMacrosPlugin


rjollos  committed 68655b4 Draft

FIX: revision was not being used to construct the repository URL, which caused immediate problems in a multi-repository environment. Entries are now sorted.

  • Participants
  • Parent commits fae79cf
  • Branches default

Comments (0)

Files changed (1)

File morewikimacros/macros.py

View file
  • Ignore whitespace
 # you should have received as part of this distribution.
 from genshi.builder import tag
+from trac.util import embedded_numbers
 from trac.util.translation import _
 from trac.versioncontrol.api import NoSuchNode, RepositoryManager
 from trac.wiki.formatter import system_message
         path, rev = _split_path(path)
         if repos.has_node(path, rev):
             node = repos.get_node(path, rev)
-            entries = [n for n in node.get_entries()
+            rev = rev or repos.get_youngest_rev()
+            entries = [n for n in sorted(node.get_entries(), key=lambda n: 
+                                         embedded_numbers(n.path.lower()))
                        if n.is_viewable(formatter.req.perm)]
             if not entries:
                 return system_message(_('Error: Invalid usage'),
             rev = rev or repos.get_youngest_rev()
             raise NoSuchNode(path, rev)
-        list_items = [tag.li(tag.a(e.path,href=formatter.req.href('browser', e.path)))
+        list_items = [tag.li(tag.a(e.path, href=formatter.href.browser(repos_name + '/' +
+                                                                       e.path, rev=rev)))
                       for e in entries]
         return tag.div(tag.ul(list_items))