/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Matthieu Moy
  • Date: 2006-08-04 16:23:43 UTC
  • mto: (2009.1.1 update-r)
  • mto: This revision was merged to the branch mainline in revision 4923.
  • Revision ID: Matthieu.Moy@imag.fr-20060804162343-5dc628faf643da23
Added test-cases for update -r. Tweaked the implementation too.

* builtins.py: don't check the master branch since we just ran
  branch.update()

* Moved the error for revision out of branch history in workingtree.py.

* Document new arguments in workingtree.update()

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
 
195
195
        # The pending merges should still be there
196
196
        self.assertEqual(['o2'], checkout1.pending_merges())
 
197
 
 
198
    def test_update_dash_r(self):
 
199
        # Test that 'bzr update' works correctly when you have
 
200
        # an update in the master tree, and a lightweight checkout
 
201
        # which has merged another branch
 
202
        master = self.make_branch_and_tree('master')
 
203
        os.chdir('master')
 
204
        self.build_tree(['./file1'])
 
205
        master.add(['file1'])
 
206
        master.commit('one', rev_id='m1')
 
207
        self.build_tree(['./file2'])
 
208
        master.add(['file2'])
 
209
        master.commit('two', rev_id='m2')
 
210
        
 
211
        out, err = self.run_bzr('update', '-r', '1')
 
212
        self.assertEqual('', out)
 
213
        self.assertEqual('All changes applied successfully.\n'
 
214
                         'Updated to revision 1.\n', err)
 
215
        self.failUnlessExists('./file1')
 
216
        self.failIfExists('./file2')
 
217
        self.check_file_contents('.bzr/checkout/last-revision',
 
218
                                 'm1')
 
219
 
 
220
    def test_update_dash_r_outside_history(self):
 
221
        # Test that 'bzr update' works correctly when you have
 
222
        # an update in the master tree, and a lightweight checkout
 
223
        # which has merged another branch
 
224
        master = self.make_branch_and_tree('master')
 
225
        self.build_tree(['master/file1'])
 
226
        master.add(['file1'])
 
227
        master.commit('one', rev_id='m1')
 
228
 
 
229
        # Create a second branch, with an extra commit
 
230
        other = master.bzrdir.sprout('other').open_workingtree()
 
231
        self.build_tree(['other/file2'])
 
232
        other.add(['file2'])
 
233
        other.commit('other2', rev_id='o2')
 
234
 
 
235
        os.chdir('master')
 
236
        self.run_bzr('merge', '../other')
 
237
        master.commit('merge', rev_id='merge')
 
238
 
 
239
        out, err = self.run_bzr('update', '-r', 'revid:o2',
 
240
                                retcode=3)
 
241
        self.assertEqual('', out)
 
242
        self.assertEqual('bzr: ERROR: branch has no revision o2\n'
 
243
                         'bzr update --revision works only'
 
244
                         ' for a revision in the branch history\n',
 
245
                         err)
 
246
 
 
247
    def test_update_dash_r_in_master(self):
 
248
        # Test that 'bzr update' works correctly when you have
 
249
        # an update in the master tree,
 
250
        master = self.make_branch_and_tree('master')
 
251
        self.build_tree(['master/file1'])
 
252
        master.add(['file1'])
 
253
        master.commit('one', rev_id='m1')
 
254
 
 
255
        self.run_bzr('checkout', 'master', 'checkout')
 
256
 
 
257
        # add a revision in the master.
 
258
        self.build_tree(['master/file2'])
 
259
        master.add(['file2'])
 
260
        master.commit('two', rev_id='m2')
 
261
 
 
262
        os.chdir('checkout')
 
263
        out, err = self.run_bzr('update', '-r', 'revid:m2')
 
264
        self.assertEqual('', out)
 
265
        self.assertEqual('All changes applied successfully.\n'
 
266
                         'Updated to revision 2.\n', err)