~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-28 13:13:49 UTC
  • mfrom: (5810.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20110428131349-dt632s6r8p3qewxb
(vila) Merge 2.3 into trunk resolving conflicts (Vincent Ladeuil)

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
22
23
import os
23
24
 
 
25
from testtools import matchers
 
26
 
24
27
from bzrlib import (
25
28
    branch,
26
29
    bzrdir,
351
354
 
352
355
    def pullable_branch(self):
353
356
        tree_a = self.make_branch_and_tree('a')
354
 
        self.build_tree(['a/file'])
 
357
        self.build_tree_contents([('a/file', 'bar\n')])
355
358
        tree_a.add(['file'])
356
359
        self.id1 = tree_a.commit('commit 1')
357
360
 
358
361
        tree_b = self.make_branch_and_tree('b')
359
362
        tree_b.pull(tree_a.branch)
360
 
        file('b/file', 'wb').write('foo')
 
363
        self.build_tree_contents([('b/file', 'foo\n')])
361
364
        self.id2 = tree_b.commit('commit 2')
362
365
 
363
366
    def test_merge_pull(self):
368
371
        tree_a = workingtree.WorkingTree.open('.')
369
372
        self.assertEqual([self.id2], tree_a.get_parent_ids())
370
373
 
 
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
 
371
389
    def test_merge_kind_change(self):
372
390
        tree_a = self.make_branch_and_tree('tree_a')
373
391
        self.build_tree_contents([('tree_a/file', 'content_1')])