You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/04/03 19:26:49 UTC

[20/46] git commit: [#5973] preserve deterministic order in diff lists, so tests always pass

[#5973] preserve deterministic order in diff lists, so tests always pass


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6127cf7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6127cf7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6127cf7a

Branch: refs/heads/cj/5879
Commit: 6127cf7ac716ade1c5f0aa6d5b78b49b4a04dc80
Parents: dcf934e
Author: Dave Brondsema <db...@geek.net>
Authored: Tue Mar 19 18:08:16 2013 -0700
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Apr 2 21:29:21 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo_refresh.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6127cf7a/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 2e176af..ca0c43b 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -1,8 +1,7 @@
 import logging
 from itertools import chain
 from cPickle import dumps
-import re
-import os
+from collections import OrderedDict
 
 import bson
 
@@ -423,8 +422,8 @@ def _diff_trees(lhs, rhs, index, *path):
     def _fq(name):
         return '/'.join(reversed(
                 (name,) + path))
-    # Diff the trees
-    rhs_tree_ids = dict(
+    # Diff the trees (and keep deterministic order)
+    rhs_tree_ids = OrderedDict(
         (o.name, o.id)
         for o in rhs.tree_ids)
     for o in lhs.tree_ids:
@@ -443,8 +442,8 @@ def _diff_trees(lhs, rhs, index, *path):
         lhs_tree = Object(_id=None, tree_ids=[], blob_ids=[], other_ids=[])
         for difference in _diff_trees(lhs_tree, index[id], index, name, *path):
             yield difference
-    # DIff the blobs
-    rhs_blob_ids = dict(
+    # Diff the blobs (and keep deterministic order)
+    rhs_blob_ids = OrderedDict(
         (o.name, o.id)
         for o in rhs.blob_ids)
     for o in lhs.blob_ids: