~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

  • Committer: Martin Pool
  • Date: 2005-08-29 03:42:38 UTC
  • Revision ID: mbp@sourcefrog.net-20050829034238-0a9b4fb9a6ce201f
- test code exercises a successful check and null upgrade of a branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
 
24
24
import os
 
25
 
25
26
from bzrlib.selftest import BzrTestBase, FunctionalTestCase
26
27
from bzrlib.branch import Branch
27
28
 
 
29
import logging
 
30
logger = logging.getLogger('bzr.test.versioning')
 
31
debug = logger.debug
 
32
 
28
33
 
29
34
class TestVersioning(FunctionalTestCase):
30
35
    
68
73
                          b.add,
69
74
                          'foo/hello')
70
75
        
 
76
        self.check_and_upgrade()
 
77
 
 
78
        
71
79
    def test_subdir_add(self):
72
80
        """Add in subdirectory should add only things from there down"""
73
81
        
98
106
        chdir('..')
99
107
        eq(run_bzr(['add']), 0)
100
108
        eq(list(b.unknowns()), [])
 
109
 
 
110
        self.check_and_upgrade()
 
111
 
 
112
 
 
113
    def check_and_upgrade(self):
 
114
        """After all the above changes, run the check and upgrade commands.
 
115
 
 
116
        The upgrade should be a no-op."""
 
117
        from bzrlib.commands import run_bzr
 
118
        b = Branch('.')
 
119
        debug('branch has %d revisions', b.revno())
 
120
        
 
121
        debug('check branch...')
 
122
        from bzrlib.check import check
 
123
        check(b)
 
124
        
 
125
        debug('upgrade branch...')
 
126
        from bzrlib.upgrade import upgrade
 
127
        upgrade(b)
 
128
        
 
129
        debug('check branch...')
 
130
        from bzrlib.check import check
 
131
        check(b)
 
132
        
 
133
 
101
134
        
102
135
        
103
136
class SubdirCommit(FunctionalTestCase):