~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-11-18 17:42:45 UTC
  • mfrom: (5533.1.4 671050-config-policy)
  • Revision ID: pqm@pqm.ubuntu.com-20101118174245-gy7ufepxeycc6ypg
(vila) Takes config policies into account and display the section names when
 needed. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
        script.run_script(self, '''\
89
89
            $ bzr config -d tree
90
90
            locations:
 
91
              [.../tree]
91
92
              hello = world
92
93
            branch:
93
94
              hello = you
102
103
              hello = world
103
104
            ''')
104
105
 
 
106
class TestConfigDisplayWithPolicy(tests.TestCaseWithTransport):
 
107
 
 
108
    def test_location_with_policy(self):
 
109
        # LocationConfig is the only one dealing with policies so far.
 
110
        self.make_branch_and_tree('tree')
 
111
        config_text = """\
 
112
[%(dir)s]
 
113
url = dir
 
114
url:policy = appendpath
 
115
[%(dir)s/tree]
 
116
url = tree
 
117
""" % {'dir': self.test_dir}
 
118
        # We don't use the config directly so we save it to disk
 
119
        config.LocationConfig.from_string(config_text, 'tree', save=True)
 
120
        # policies are displayed with their options since they are part of
 
121
        # their definition, likewise the path is not appended, we are just
 
122
        # presenting the relevant portions of the config files
 
123
        script.run_script(self, '''\
 
124
            $ bzr config -d tree --all url
 
125
            locations:
 
126
              [.../work/tree]
 
127
              url = tree
 
128
              [.../work]
 
129
              url = dir
 
130
              url:policy = appendpath
 
131
            ''')
 
132
 
105
133
 
106
134
class TestConfigActive(tests.TestCaseWithTransport):
107
135
 
162
190
            $ bzr config -d tree --scope locations hello=world
163
191
            $ bzr config -d tree --all hello
164
192
            locations:
 
193
              [.../work/tree]
165
194
              hello = world
166
195
            ''')
167
196
 
197
226
            $ bzr config --scope bazaar --remove file
198
227
            $ bzr config -d tree --all file
199
228
            locations:
 
229
              [.../work/tree]
200
230
              file = locations
201
231
            branch:
202
232
              file = branch
207
237
            $ bzr config -d tree --scope bazaar --remove file
208
238
            $ bzr config -d tree --all file
209
239
            locations:
 
240
              [.../work/tree]
210
241
              file = locations
211
242
            branch:
212
243
              file = branch
243
274
            $ bzr config -d tree --scope branch --remove file
244
275
            $ bzr config -d tree --all file
245
276
            locations:
 
277
              [.../work/tree]
246
278
              file = locations
247
279
            bazaar:
248
280
              file = bazaar