~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_version_info.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib import (
25
25
    errors,
 
26
    registry,
26
27
    symbol_versioning,
27
28
    tests,
28
29
    version_info_formats,
148
149
        stanza = regen(check_for_clean=True, include_file_revisions=True)
149
150
        self.assertEqual(['False'], stanza.get_all('clean'))
150
151
 
151
 
        # XXX: This assumes it's being run against a repository that updates
152
 
        # the root revision on every commit.  Newer ones that use
153
 
        # RootCommitBuilder won't update it on each commit.
 
152
        # This assumes it's being run against a tree that does not update the
 
153
        # root revision on every commit.
154
154
        file_rev_stanza = get_one_stanza(stanza, 'file-revisions')
155
155
        self.assertEqual(['', 'a', 'b', 'c'], file_rev_stanza.get_all('path'))
156
 
        self.assertEqual(['r3', 'r3', 'r2', 'unversioned'],
 
156
        self.assertEqual(['r1', 'r3', 'r2', 'unversioned'],
157
157
            file_rev_stanza.get_all('revision'))
158
158
        os.remove('branch/c')
159
159
 
171
171
        file_rev_stanza = get_one_stanza(stanza, 'file-revisions')
172
172
        self.assertEqual(['', 'a', 'b', 'c', 'd'],
173
173
                          file_rev_stanza.get_all('path'))
174
 
        self.assertEqual(['r3', 'modified', 'renamed to d', 'new',
 
174
        self.assertEqual(['r1', 'modified', 'renamed to d', 'new',
175
175
                          'renamed from b'],
176
176
                         file_rev_stanza.get_all('revision'))
177
177
 
181
181
        stanza = regen(check_for_clean=True, include_file_revisions=True)
182
182
        file_rev_stanza = get_one_stanza(stanza, 'file-revisions')
183
183
        self.assertEqual(['', 'a', 'c', 'd'], file_rev_stanza.get_all('path'))
184
 
        self.assertEqual(['r4', 'r4', 'unversioned', 'removed'],
 
184
        self.assertEqual(['r1', 'r4', 'unversioned', 'removed'],
185
185
                         file_rev_stanza.get_all('revision'))
186
186
 
187
187
    def test_python_null(self):
326
326
 
327
327
    def setUp(self):
328
328
        super(TestVersionInfoFormatRegistry, self).setUp()
329
 
        registry = version_info_formats.format_registry
330
 
        self._default_key = registry._default_key
331
 
        self._dict = registry._dict.copy()
332
 
        self._help_dict = registry._help_dict.copy()
333
 
        self._info_dict = registry._info_dict.copy()
334
 
        self.addCleanup(self._cleanup)
335
 
 
336
 
    def _cleanup(self):
337
 
        # Restore the registry to pristine state after the test runs
338
 
        registry = version_info_formats.format_registry
339
 
        registry._default_key = self._default_key
340
 
        registry._dict = self._dict
341
 
        registry._help_dict = self._help_dict
342
 
        registry._info_dict = self._info_dict
 
329
        self.overrideAttr(version_info_formats,
 
330
                          'format_registry', registry.Registry())
343
331
 
344
332
    def test_register_remove(self):
345
333
        registry = version_info_formats.format_registry