~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

  • Committer: Robert Collins
  • Date: 2005-09-26 08:56:15 UTC
  • mto: (1092.3.4)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: robertc@robertcollins.net-20050926085615-99b8fb35f41b541d
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
        from bzrlib.diff import compare_trees
46
46
        from bzrlib.branch import Branch
47
 
        b = Branch('.')
 
47
        b = Branch.open('.')
48
48
        
49
49
        delta = compare_trees(b.basis_tree(), b.working_tree())
50
50
 
63
63
        from bzrlib.branch import Branch
64
64
        from bzrlib.errors import NotVersionedError
65
65
 
66
 
        b = Branch('.', init=True)
 
66
        b = Branch.initialize('.')
67
67
 
68
68
        self.build_tree(['foo/',
69
69
                         'foo/hello'])
84
84
        from bzrlib.commands import run_bzr
85
85
        eq = self.assertEqual
86
86
 
87
 
        b = Branch('.', init=True)
 
87
        b = Branch.initialize('.')
88
88
 
89
89
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
90
90
        eq(list(b.unknowns()), ['inertiatic'])
112
112
        from bzrlib.commands import run_bzr
113
113
        eq = self.assertEqual
114
114
 
115
 
        b = Branch('.', init=True)
 
115
        b = Branch.initialize('.')
116
116
 
117
117
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
118
118
        eq(list(b.unknowns()), ['inertiatic'])
119
119
        run_bzr(['add', '--no-recurse', 'inertiatic'])
120
 
        eq(list(b.unknowns()), ['inertiatic/esp'])
 
120
        eq(list(b.unknowns()), ['inertiatic'+os.sep+'esp'])
121
121
        run_bzr(['add', 'inertiatic/esp'])
122
122
        eq(list(b.unknowns()), [])
123
123
 
131
131
        ass = self.assert_
132
132
        chdir = os.chdir
133
133
        
134
 
        b = Branch('.', init=True)
 
134
        b = Branch.initialize('.')
135
135
        self.build_tree(['src/', 'README'])
136
136
        
137
137
        eq(sorted(b.unknowns()),
159
159
        """After all the above changes, run the check and upgrade commands.
160
160
 
161
161
        The upgrade should be a no-op."""
162
 
        b = Branch('.')
 
162
        b = Branch.open('.')
163
163
        debug('branch has %d revisions', b.revno())
164
164
        
165
165
        debug('check branch...')
186
186
        self.build_tree(['a/', 'b/'])
187
187
        
188
188
        run_bzr('init')
189
 
        b = Branch('.')
 
189
        b = Branch.open('.')
190
190
        
191
191
        for fn in ('a/one', 'b/two', 'top'):
192
192
            file(fn, 'w').write('old contents')
199
199
            
200
200
        run_bzr('commit', 'a', '-m', 'commit a only')
201
201
        
202
 
        old = b.revision_tree(b.lookup_revision(1))
203
 
        new = b.revision_tree(b.lookup_revision(2))
 
202
        old = b.revision_tree(b.get_rev_id(1))
 
203
        new = b.revision_tree(b.get_rev_id(2))
204
204
        
205
205
        eq(new.get_file_by_path('b/two').read(), 'old contents')
206
206
        eq(new.get_file_by_path('top').read(), 'old contents')
209
209
        os.chdir('a')
210
210
        # commit from here should do nothing
211
211
        run_bzr('commit', '.', '-m', 'commit subdir only', '--unchanged')
212
 
        v3 = b.revision_tree(b.lookup_revision(3))
 
212
        v3 = b.revision_tree(b.get_rev_id(3))
213
213
        eq(v3.get_file_by_path('b/two').read(), 'old contents')
214
214
        eq(v3.get_file_by_path('top').read(), 'old contents')
215
215
        eq(v3.get_file_by_path('a/one').read(), 'new contents')
216
216
                
217
217
        # commit in subdirectory commits whole tree
218
218
        run_bzr('commit', '-m', 'commit whole tree from subdir')
219
 
        v4 = b.revision_tree(b.lookup_revision(4))
 
219
        v4 = b.revision_tree(b.get_rev_id(4))
220
220
        eq(v4.get_file_by_path('b/two').read(), 'new contents')        
221
221
        eq(v4.get_file_by_path('top').read(), 'new contents')
222
222