Kiln » Dependencies » Dulwich Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master

Preserve the order of configuration files.

Changeset 6d2a7d3c10dc

Parent 2a8548be3b1f

by Benjamin Pollack

Changes to one file · Browse files at 6d2a7d3c10dc Showing diff from parent 2a8548be3b1f Diff from another changeset...

Change 1 of 7 Show Entire File dulwich/​config.py Stacked
 
28
29
30
 
31
32
33
 
38
39
40
41
 
42
43
44
 
67
68
69
70
 
71
72
73
 
81
82
83
84
 
85
86
87
 
94
95
96
97
 
98
99
100
 
101
102
103
 
122
123
124
125
 
126
127
128
 
236
237
238
239
 
240
241
242
 
28
29
30
31
32
33
34
 
39
40
41
 
42
43
44
45
 
68
69
70
 
71
72
73
74
 
82
83
84
 
85
86
87
88
 
95
96
97
 
98
99
100
 
101
102
103
104
 
123
124
125
 
126
127
128
129
 
237
238
239
 
240
241
242
243
@@ -28,6 +28,7 @@
 import os  import re   +from collections import OrderedDict  from UserDict import DictMixin    from dulwich.file import GitFile @@ -38,7 +39,7 @@
    def get(self, section, name):   """Retrieve the contents of a configuration setting. - +   :param section: Tuple with section name and optional subsection namee   :param subsection: Subsection name   :return: Contents of the setting @@ -67,7 +68,7 @@
    def set(self, section, name, value):   """Set a configuration value. - +   :param name: Name of the configuration value, including section   and optional subsection   :param: Value of the setting @@ -81,7 +82,7 @@
  def __init__(self, values=None):   """Create a new ConfigDict."""   if values is None: - values = {} + values = OrderedDict()   self._values = values     def __repr__(self): @@ -94,10 +95,10 @@
    def __getitem__(self, key):   return self._values[key] - +   def __setitem__(self, key, value):   self._values[key] = value - +   def keys(self):   return self._values.keys()   @@ -122,7 +123,7 @@
  def set(self, section, name, value):   if isinstance(section, basestring):   section = (section, ) - self._values.setdefault(section, {})[name] = value + self._values.setdefault(section, OrderedDict())[name] = value      def _format_string(value): @@ -236,7 +237,7 @@
  section = (pts[0], pts[1])   else:   section = (pts[0], ) - ret._values[section] = {} + ret._values[section] = OrderedDict()   if _strip_comments(line).strip() == "":   continue   if section is None: