~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import os
18
18
import os.path
19
19
from cStringIO import StringIO
20
 
import errno
21
20
import subprocess
22
21
import sys
23
22
from tempfile import TemporaryFile
33
32
    internal_diff,
34
33
    show_diff_trees,
35
34
    get_trees_and_branches_to_diff,
 
35
    get_trees_and_branches_to_diff_locked,
36
36
    )
37
37
from bzrlib.errors import BinaryFile, NoDiff, ExecutableMissing
38
38
import bzrlib.osutils as osutils
44
44
                          TestCaseInTempDir, TestSkipped)
45
45
from bzrlib.revisiontree import RevisionTree
46
46
from bzrlib.revisionspec import RevisionSpec
 
47
from bzrlib.symbol_versioning import deprecated_in
47
48
 
48
49
from bzrlib.tests.test_win32utils import BackslashDirSeparatorFeature
49
50
 
1394
1395
        diff_obj._prepare_files('file2-id', 'oldname2', 'newname2')
1395
1396
 
1396
1397
 
1397
 
class TestGetTreesAndBranchesToDiff(TestCaseWithTransport):
 
1398
class TestGetTreesAndBranchesToDiffLocked(TestCaseWithTransport):
 
1399
 
 
1400
    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
 
1401
        """Call get_trees_and_branches_to_diff_locked.  Overridden by
 
1402
        TestGetTreesAndBranchesToDiff.
 
1403
        """
 
1404
        return get_trees_and_branches_to_diff_locked(
 
1405
            path_list, revision_specs, old_url, new_url, self.addCleanup)
1398
1406
 
1399
1407
    def test_basic(self):
1400
1408
        tree = self.make_branch_and_tree('tree')
1401
1409
        (old_tree, new_tree,
1402
1410
         old_branch, new_branch,
1403
 
         specific_files, extra_trees) = \
1404
 
            get_trees_and_branches_to_diff(['tree'], None, None, None)
 
1411
         specific_files, extra_trees) = self.call_gtabtd(
 
1412
             ['tree'], None, None, None)
1405
1413
 
1406
1414
        self.assertIsInstance(old_tree, RevisionTree)
1407
 
        #print dir (old_tree)
1408
1415
        self.assertEqual(_mod_revision.NULL_REVISION, old_tree.get_revision_id())
1409
1416
        self.assertEqual(tree.basedir, new_tree.basedir)
1410
1417
        self.assertEqual(tree.branch.base, old_branch.base)
1424
1431
                     RevisionSpec.from_string('2')]
1425
1432
        (old_tree, new_tree,
1426
1433
         old_branch, new_branch,
1427
 
         specific_files, extra_trees) = \
1428
 
            get_trees_and_branches_to_diff(['tree'], revisions, None, None)
 
1434
         specific_files, extra_trees) = self.call_gtabtd(
 
1435
            ['tree'], revisions, None, None)
1429
1436
 
1430
1437
        self.assertIsInstance(old_tree, RevisionTree)
1431
1438
        self.assertEqual("old-id", old_tree.get_revision_id())
1435
1442
        self.assertEqual(tree.branch.base, new_branch.base)
1436
1443
        self.assertIs(None, specific_files)
1437
1444
        self.assertEqual(tree.basedir, extra_trees[0].basedir)
 
1445
 
 
1446
 
 
1447
class TestGetTreesAndBranchesToDiff(TestGetTreesAndBranchesToDiffLocked):
 
1448
    """Apply the tests for get_trees_and_branches_to_diff_locked to the
 
1449
    deprecated get_trees_and_branches_to_diff function.
 
1450
    """
 
1451
 
 
1452
    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
 
1453
        return self.applyDeprecated(
 
1454
            deprecated_in((2, 2, 0)), get_trees_and_branches_to_diff,
 
1455
            path_list, revision_specs, old_url, new_url)
 
1456