--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -7,6 +7,7 @@
 import tg
 
 from ming.base import Object
+from ming.orm import mapper, session
 
 from allura.lib import utils
 from allura.lib import helpers as h
@@ -65,7 +66,7 @@
 
     # Compute diffs
     cache = {}
-    for i, oid in enumerate(commit_ids):
+    for i, oid in enumerate(reversed(commit_ids)):
         ci = CommitDoc.m.find(dict(_id=oid), validate=False).next()
         compute_diffs(repo._id, cache, ci)
         if (i+1) % 100 == 0:
@@ -192,6 +193,7 @@
             parent_run = runs.get(p_cis[0], None)
             if parent_run is None: continue
             run['commit_ids'] += parent_run['commit_ids']
+            run['commit_times'] += parent_run['commit_times']
             run['parent_commit_ids'] = parent_run['parent_commit_ids']
             run.m.save()
             runs[p_cis[0]].m.delete()
@@ -289,16 +291,30 @@
     else:
         lhs_tree = tree_index[lhs_ci.tree_id]
     differences = []
+    commit_info = get_commit_info(rhs_ci)
     for name, lhs_id, rhs_id in _diff_trees(lhs_tree, rhs_tree, tree_index):
         differences.append(
             dict(name=name, lhs_id=lhs_id, rhs_id=rhs_id))
         # Set last commit info
         if rhs_id is not None:
-            _set_last_commit(repo_id, rhs_id, rhs_ci)
+            set_last_commit(repo_id, rhs_id, commit_info)
         rhs_tree = tree_index.get(rhs_id, None)
         if rhs_tree is not None:
             for oid in _walk_tree(rhs_tree, tree_index):
-                _set_last_commit(repo_id, oid, rhs_ci)
+                set_last_commit(repo_id, oid, commit_info)
+    # Set last commit data for trees without it in the RHS
+    if True:
+        last_commit_collection = LastCommitDoc.m.session.db[
+            LastCommitDoc.m.collection_name]
+        last_commits = set(
+            d['object_id']
+            for d in last_commit_collection.find(
+                dict(object_id={'$in': rhs_tree_ids}),
+                { 'object_id': 1, '_id': 0 }))
+        for tree_id in rhs_tree_ids:
+            if tree_id not in last_commits:
+                set_last_commit(repo_id, tree_id, commit_info)
+   # Build the diffinfo
     di = DiffInfoDoc(dict(
             _id=rhs_ci._id,
             differences=differences))
@@ -308,7 +324,6 @@
 def send_notifications(repo, commit_ids):
     '''Create appropriate notification and feed objects for a refresh'''
     from allura.model import Feed, Notification
-    from allura.model.repository import config
     commit_msgs = []
     base_url = tg.config.get('base_url', 'sourceforge.net')
     for oids in utils.chunked_iter(commit_ids, QSIZE):
@@ -326,7 +341,7 @@
                     summary, href),
                 author_link=ci.author_url,
                 author_name=ci.authored.name)
-            branches = repo.symbolics_for_commit(ci.legacy)[0]
+            branches = repo.symbolics_for_commit(ci)[0]
             commit_msgs.append('%s: %s by %s %s%s' % (
                     ",".join(b for b in branches),
                     summary, ci.authored.name, base_url, ci.url()))
@@ -341,7 +356,7 @@
                 repo.app.project.name,
                 repo.app.config.options.mount_label,
                 summary)
-            branches = repo.symbolics_for_commit(ci.legacy)[0]
+            branches = repo.symbolics_for_commit(ci)[0]
             text = "%s: %s %s%s" % (",".join(b for b in branches),
                                ci.message,
                                base_url, ci.url())
@@ -397,20 +412,24 @@
     for name, id in rhs_blob_ids.items():
         yield (_fq(name), None, id)
 
-def _set_last_commit(repo_id, oid, commit):
+def get_commit_info(commit):
+    if not isinstance(commit, Commit):
+        commit = mapper(Commit).create(commit, dict(instrument=False))
+    session(commit).expunge(commit)
+    return dict(
+        id=commit._id,
+        author=commit.authored.name,
+        author_email=commit.authored.email,
+        date=commit.authored.date,
+        author_url=commit.author_url,
+        shortlink=commit.shorthand_id(),
+        summary=commit.summary
+        )
+
+def set_last_commit(repo_id, oid, commit_info):
     lc = LastCommitDoc(dict(
             _id='%s:%s' % (repo_id, oid),
-            repo_id=repo_id,
             object_id=oid,
-            commit_info=dict(
-                id=commit._id,
-                author=commit.authored.name,
-                author_email=commit.authored.email,
-                date=commit.authored.date,
-                # author_url=commit.author_url,
-                # href=commit.url(),
-                # shortlink=commit.shorthand_id(),
-                # summary=commit.summary
-                )))
-    lc.m.save(safe=False)
+            commit_info=commit_info))
+    lc.m.save(safe=False, upsert=True)
     return lc