You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/03/20 02:09:08 UTC

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

Updated Branches:
  refs/heads/db/5973 88669f732 -> 8c018a146


[#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/8c018a14
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8c018a14
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8c018a14

Branch: refs/heads/db/5973
Commit: 8c018a146be7062f24061659a57cf16b2fe61ecb
Parents: 55bdb40
Author: Dave Brondsema <db...@geek.net>
Authored: Tue Mar 19 18:08:16 2013 -0700
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 19 18:08:16 2013 -0700

----------------------------------------------------------------------
 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/8c018a14/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 539df2a..0b725f2 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
 
@@ -421,8 +420,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:
@@ -441,8 +440,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: