Commits

Jason S committed 89bd547

forgot to output dicts in order sorted by key

  • Participants
  • Parent commits 39b5ed7

Comments (0)

Files changed (1)

File src/svnfingerprint.py

     expectNewline(f)
     return result    
     
+def sortDictByKey(d):
+    result = OrderedDict()
+    for key in sorted(d.keys()):
+        result[key] = d[key]
+    return result
+    
 def readRevProps(f):
-    result = OrderedDict()
+    result = {}
     while True:
         line = f.readline().rstrip('\n')
         if (line == 'PROPS-END'):
         line = f.readline().rstrip('\n')
         value = readKeyValue(f, line, vpattern)
         result[key]=value
-    return result
+    return sortDictByKey(result)
 
 
 class SvndumpParser(object):
         self.peek()
         return m.group(2)        
     def readParameters(self):
-        result = OrderedDict()
+        result = {}
         while self.line != '':
             m = parampattern.match(self.line)
             result[m.group(1)] = m.group(2)
             self.peek()
-        return result
+        return sortDictByKey(result)
     def readProps(self, h):
         proplen = int(h['Prop-content-length'])
         return readRevProps(StringIO.StringIO(self.f.read(proplen)))