~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-16 01:09:56 UTC
  • mfrom: (5784.1.4 760435-less-fail)
  • Revision ID: pqm@pqm.ubuntu.com-20110416010956-5wrpm136qq2hz5f3
(mbp) rename and deprecate failUnlessExists and failIfExists (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
"""Black-box tests for bzr merge.
20
20
"""
21
21
 
22
 
import doctest
23
22
import os
24
23
 
25
 
from testtools import matchers
26
 
 
27
24
from bzrlib import (
28
25
    branch,
29
26
    bzrdir,
354
351
 
355
352
    def pullable_branch(self):
356
353
        tree_a = self.make_branch_and_tree('a')
357
 
        self.build_tree_contents([('a/file', 'bar\n')])
 
354
        self.build_tree(['a/file'])
358
355
        tree_a.add(['file'])
359
356
        self.id1 = tree_a.commit('commit 1')
360
357
 
361
358
        tree_b = self.make_branch_and_tree('b')
362
359
        tree_b.pull(tree_a.branch)
363
 
        self.build_tree_contents([('b/file', 'foo\n')])
 
360
        file('b/file', 'wb').write('foo')
364
361
        self.id2 = tree_b.commit('commit 2')
365
362
 
366
363
    def test_merge_pull(self):
371
368
        tree_a = workingtree.WorkingTree.open('.')
372
369
        self.assertEqual([self.id2], tree_a.get_parent_ids())
373
370
 
374
 
    def test_merge_pull_preview(self):
375
 
        self.pullable_branch()
376
 
        (out, err) = self.run_bzr('merge --pull --preview -d a b')
377
 
        self.assertThat(out, matchers.DocTestMatches(
378
 
"""=== modified file 'file'
379
 
--- file\t...
380
 
+++ file\t...
381
 
@@ -1,1 +1,1 @@
382
 
-bar
383
 
+foo
384
 
 
385
 
""", doctest.ELLIPSIS | doctest.REPORT_UDIFF))
386
 
        tree_a = workingtree.WorkingTree.open('a')
387
 
        self.assertEqual([self.id1], tree_a.get_parent_ids())
388
 
 
389
371
    def test_merge_kind_change(self):
390
372
        tree_a = self.make_branch_and_tree('tree_a')
391
373
        self.build_tree_contents([('tree_a/file', 'content_1')])