~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2010-08-18 07:25:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5383.
  • Revision ID: mbp@sourcefrog.net-20100818072522-uk3gsazoia3l3s0a
Start adding 'what's new in 2.3'

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
Updated to revision 1 of branch %s
91
91
""" % osutils.pathjoin(self.test_dir, 'branch',),
92
92
                         err)
93
 
        self.assertPathExists('branch/file')
 
93
        self.failUnlessExists('branch/file')
94
94
 
95
95
    def test_update_out_of_date_light_checkout(self):
96
96
        self.make_branch_and_tree('branch')
140
140
        # smoke test for doing an update of a checkout of a bound
141
141
        # branch with local commits.
142
142
        master = self.make_branch_and_tree('master')
143
 
        master.commit('first commit')
144
143
        # make a bound branch
145
144
        self.run_bzr('checkout master child')
 
145
        # get an object form of child
 
146
        child = workingtree.WorkingTree.open('child')
146
147
        # check that out
147
148
        self.run_bzr('checkout --lightweight child checkout')
148
149
        # get an object form of the checkout to manipulate
157
158
        a_file = file('child/file_b', 'wt')
158
159
        a_file.write('Foo')
159
160
        a_file.close()
160
 
        # get an object form of child
161
 
        child = workingtree.WorkingTree.open('child')
162
161
        child.add(['file_b'])
163
162
        child_tip = child.commit('add file_b', local=True)
164
163
        # check checkout
175
174
All changes applied successfully.
176
175
+N  file
177
176
All changes applied successfully.
178
 
Updated to revision 2 of branch %s
 
177
Updated to revision 1 of branch %s
179
178
Your local commits will now show as pending merges with 'bzr status', and can be committed with 'bzr commit'.
180
179
""" % osutils.pathjoin(self.test_dir, 'master',),
181
180
                         err)
182
181
        self.assertEqual([master_tip, child_tip], wt.get_parent_ids())
183
 
        self.assertPathExists('checkout/file')
184
 
        self.assertPathExists('checkout/file_b')
185
 
        self.assertPathExists('checkout/file_c')
 
182
        self.failUnlessExists('checkout/file')
 
183
        self.failUnlessExists('checkout/file_b')
 
184
        self.failUnlessExists('checkout/file_c')
186
185
        self.assertTrue(wt.has_filename('file_c'))
187
186
 
188
187
    def test_update_with_merges(self):
300
299
2>All changes applied successfully.
301
300
2>Updated to revision 1 of .../master
302
301
''')
303
 
        self.assertPathExists('./file1')
304
 
        self.assertPathDoesNotExist('./file2')
 
302
        self.failUnlessExists('./file1')
 
303
        self.failIfExists('./file2')
305
304
        self.assertEquals(['m1'], master.get_parent_ids())
306
305
 
307
306
    def test_update_dash_r_outside_history(self):
360
359
2>Updated to revision 2 of branch .../master
361
360
''')
362
361
 
363
 
    def test_update_show_base(self):
364
 
        """bzr update support --show-base
365
 
 
366
 
        see https://bugs.launchpad.net/bzr/+bug/202374"""
367
 
 
368
 
        tree=self.make_branch_and_tree('.')
369
 
 
370
 
        f = open('hello','wt')
371
 
        f.write('foo')
372
 
        f.close()
373
 
        tree.add('hello')
374
 
        tree.commit('fie')
375
 
 
376
 
        f = open('hello','wt')
377
 
        f.write('fee')
378
 
        f.close()
379
 
        tree.commit('fee')
380
 
 
381
 
        #tree.update() gives no such revision, so ...
382
 
        self.run_bzr(['update','-r1'])
383
 
 
384
 
        #create conflict
385
 
        f = open('hello','wt')
386
 
        f.write('fie')
387
 
        f.close()
388
 
 
389
 
        out, err = self.run_bzr(['update','--show-base'],retcode=1)
390
 
 
391
 
        # check for conflict notification
392
 
        self.assertContainsString(err,
393
 
                                  ' M  hello\nText conflict in hello\n1 conflicts encountered.\n')
394
 
        
395
 
        self.assertEqualDiff('<<<<<<< TREE\n'
396
 
                             'fie||||||| BASE-REVISION\n'
397
 
                             'foo=======\n'
398
 
                             'fee>>>>>>> MERGE-SOURCE\n',
399
 
                             open('hello').read())
400
 
 
401
362
    def test_update_checkout_prevent_double_merge(self):
402
363
        """"Launchpad bug 113809 in bzr "update performs two merges"
403
364
        https://launchpad.net/bugs/113809"""