Switch to side-by-side view

--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -127,7 +127,7 @@
         downstream=dict(
             project_id=c.project._id,
             mount_point=c.app.config.options.mount_point,
-            commit_id=c.app.repo.commit(kw['source_branch']).object_id)
+            commit_id=c.app.repo.commit(kw['source_branch'])._id)
         with c.app.repo.push_upstream_context():
             mr = M.MergeRequest.upsert(
                 downstream=downstream,
@@ -200,10 +200,9 @@
             for p_oid in ci.parent_ids:
                 children[p_oid].append(oid)
         result = []
-
         for row, oid in enumerate(topo_sort(children, parents, dates, head_ids)):
             ci = commits_by_id[oid]
-            url=c.app.repo.url_for_commit(Object(object_id=oid))
+            url=c.app.repo.url_for_commit(Object(_id=oid))
             msg_split = ci.message.splitlines()
             if msg_split:
                 msg = msg_split[0]
@@ -266,11 +265,11 @@
                         email=commit.authored.email,
                     ),
                     url=commit.url(),
-                    id=commit.object_id,
+                    id=commit._id,
                     committed_date=commit.committed.date,
                     authored_date=commit.authored.date,
                     message=commit.message,
-                    tree=commit.tree.object_id,
+                    tree=commit.tree._id,
                     committer=dict(
                         name=commit.committed.name,
                         email=commit.committed.email,
@@ -408,7 +407,7 @@
     def log(self, limit=None, page=0, count=0, **kw):
         limit, page, start = g.handle_paging(limit, page)
         revisions = c.app.repo.log(
-                branch=self._commit.object_id,
+                branch=self._commit._id,
                 offset=start,
                 limit=limit)
         c.log_widget = self.log_widget
@@ -451,14 +450,19 @@
             filename = h.really_unicode(
                 unquote(
                     request.environ['PATH_INFO'].rsplit('/')[-1]))
-            if filename and filename in self._tree.object_id_index and self._tree.is_blob(filename):
-                return self.FileBrowserClass(
-                    self._commit,
-                    self._tree,
-                    filename), rest
+            if filename:
+                try:
+                    obj = self._tree[filename]
+                except KeyError:
+                    raise exc.HTTPNotFound()
+                if isinstance(obj, M.repo.Blob):
+                    return self.FileBrowserClass(
+                        self._commit,
+                        self._tree,
+                        filename), rest
         elif rest == ('index', ):
             rest = (request.environ['PATH_INFO'].rsplit('/')[-1],)
-        tree = self._tree.get_tree(next)
+        tree = self._tree[next]
         if tree is None:
             raise exc.HTTPNotFound
         return self.__class__(
@@ -532,11 +536,10 @@
             diff=diff)
 
 def topo_sort(children, parents, dates, head_ids):
-    to_visit = set(head_ids)
+    to_visit = sorted(list(set(head_ids)), key=lambda x: dates[x])
     visited = set()
     while to_visit:
-        next = max(to_visit, key=lambda x: dates[x])
-        to_visit.remove(next)
+        next = to_visit.pop()
         if next in visited: continue
         visited.add(next)
         yield next
@@ -544,6 +547,6 @@
             for c in children[p]:
                 if c not in visited: break
             else:
-                to_visit.add(p)
+                to_visit.append(p)
 
 on_import()