~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2011-07-18 14:22:20 UTC
  • mto: This revision was merged to the branch mainline in revision 6033.
  • Revision ID: john@arbash-meinel.com-20110718142220-nwylw659oip1ene9
Start at least testing the package_branch regex.
And start testing the is-up-to-date logic.

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.failUnlessExists('branch/file')
 
93
        self.assertPathExists('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')
143
144
        # make a bound branch
144
145
        self.run_bzr('checkout master child')
145
 
        # get an object form of child
146
 
        child = workingtree.WorkingTree.open('child')
147
146
        # check that out
148
147
        self.run_bzr('checkout --lightweight child checkout')
149
148
        # get an object form of the checkout to manipulate
158
157
        a_file = file('child/file_b', 'wt')
159
158
        a_file.write('Foo')
160
159
        a_file.close()
 
160
        # get an object form of child
 
161
        child = workingtree.WorkingTree.open('child')
161
162
        child.add(['file_b'])
162
163
        child_tip = child.commit('add file_b', local=True)
163
164
        # check checkout
174
175
All changes applied successfully.
175
176
+N  file
176
177
All changes applied successfully.
177
 
Updated to revision 1 of branch %s
 
178
Updated to revision 2 of branch %s
178
179
Your local commits will now show as pending merges with 'bzr status', and can be committed with 'bzr commit'.
179
180
""" % osutils.pathjoin(self.test_dir, 'master',),
180
181
                         err)
181
182
        self.assertEqual([master_tip, child_tip], wt.get_parent_ids())
182
 
        self.failUnlessExists('checkout/file')
183
 
        self.failUnlessExists('checkout/file_b')
184
 
        self.failUnlessExists('checkout/file_c')
 
183
        self.assertPathExists('checkout/file')
 
184
        self.assertPathExists('checkout/file_b')
 
185
        self.assertPathExists('checkout/file_c')
185
186
        self.assertTrue(wt.has_filename('file_c'))
186
187
 
187
188
    def test_update_with_merges(self):
299
300
2>All changes applied successfully.
300
301
2>Updated to revision 1 of .../master
301
302
''')
302
 
        self.failUnlessExists('./file1')
303
 
        self.failIfExists('./file2')
 
303
        self.assertPathExists('./file1')
 
304
        self.assertPathDoesNotExist('./file2')
304
305
        self.assertEquals(['m1'], master.get_parent_ids())
305
306
 
306
307
    def test_update_dash_r_outside_history(self):
359
360
2>Updated to revision 2 of branch .../master
360
361
''')
361
362
 
 
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
 
362
401
    def test_update_checkout_prevent_double_merge(self):
363
402
        """"Launchpad bug 113809 in bzr "update performs two merges"
364
403
        https://launchpad.net/bugs/113809"""