incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [03/15] git commit: [#5973] preserve deterministic order in diff lists, so tests always pass
Date Tue, 02 Apr 2013 21:29:50 GMT
[#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/master
Commit: 6127cf7ac716ade1c5f0aa6d5b78b49b4a04dc80
Parents: dcf934e
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Tue Mar 19 18:08:16 2013 -0700
Committer: Tim Van Steenburgh <tvansteenburgh@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:


Mime
View raw message