~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(jameinel) Bug #760152,
 'bzr merge --preview --pull' should not change the last-revision (be
 equivalent to "bzr merge --preview") (John A Meinel)

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
    branchbuilder,
352
355
 
353
356
    def pullable_branch(self):
354
357
        tree_a = self.make_branch_and_tree('a')
355
 
        self.build_tree(['a/file'])
 
358
        self.build_tree_contents([('a/file', 'bar\n')])
356
359
        tree_a.add(['file'])
357
360
        self.id1 = tree_a.commit('commit 1')
358
361
 
359
362
        tree_b = self.make_branch_and_tree('b')
360
363
        tree_b.pull(tree_a.branch)
361
 
        file('b/file', 'wb').write('foo')
 
364
        self.build_tree_contents([('b/file', 'foo\n')])
362
365
        self.id2 = tree_b.commit('commit 2')
363
366
 
364
367
    def test_merge_pull(self):
369
372
        tree_a = workingtree.WorkingTree.open('.')
370
373
        self.assertEqual([self.id2], tree_a.get_parent_ids())
371
374
 
 
375
    def test_merge_pull_preview(self):
 
376
        self.pullable_branch()
 
377
        (out, err) = self.run_bzr('merge --pull --preview -d a b')
 
378
        self.assertThat(out, matchers.DocTestMatches(
 
379
"""=== modified file 'file'
 
380
--- file\t...
 
381
+++ file\t...
 
382
@@ -1,1 +1,1 @@
 
383
-bar
 
384
+foo
 
385
 
 
386
""", doctest.ELLIPSIS | doctest.REPORT_UDIFF))
 
387
        tree_a = workingtree.WorkingTree.open('a')
 
388
        self.assertEqual([self.id1], tree_a.get_parent_ids())
 
389
 
372
390
    def test_merge_kind_change(self):
373
391
        tree_a = self.make_branch_and_tree('tree_a')
374
392
        self.build_tree_contents([('tree_a/file', 'content_1')])