~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Robert Collins
  • Date: 2005-10-10 01:32:08 UTC
  • Revision ID: robertc@robertcollins.net-20051010013208-163c23746972763a
branch: namespace

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import os
32
32
 
33
33
from bzrlib.branch import Branch
 
34
from bzrlib.clone import copy_branch
34
35
from bzrlib.errors import BzrCommandError
35
36
from bzrlib.osutils import has_symlinks
36
37
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
265
266
        output = self.runbzr('diff -r last:3..last:1', backtick=1)
266
267
        self.assert_('\n+baz' in output)
267
268
 
 
269
    def test_diff_branches(self):
 
270
        self.build_tree(['branch1/', 'branch1/file', 'branch2/'])
 
271
        branch = Branch.initialize('branch1')
 
272
        branch.add(['file'])
 
273
        branch.commit('add file')
 
274
        copy_branch(branch, 'branch2')
 
275
        print >> open('branch2/file', 'w'), 'new content'
 
276
        branch2 = Branch.open('branch2')
 
277
        branch2.commit('update file')
 
278
        # should open branch1 and diff against branch2, 
 
279
        output = self.run_bzr_captured(['diff', '-r', 'branch:branch2', 'branch1'])
 
280
        self.assertEquals(("=== modified file 'file'\n"
 
281
                           "--- file\n"
 
282
                           "+++ file\n"
 
283
                           "@@ -1,1 +1,1 @@\n"
 
284
                           "-new content\n"
 
285
                           "+contents of branch1/file\n"
 
286
                           "\n", ''), output)
 
287
 
268
288
    def test_branch(self):
269
289
        """Branch from one branch to another."""
270
290
        os.mkdir('a')