/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

Merge bzr.dev to resolve conflicts

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
 
1366
1367
        self.build_tree_contents([('tree/oldname2', 'oldcontent2')])
1367
1368
        tree.add('oldname', 'file-id')
1368
1369
        tree.add('oldname2', 'file2-id')
1369
 
        tree.commit('old tree', timestamp=0)
 
1370
        # Earliest allowable date on FAT32 filesystems is 1980-01-01
 
1371
        tree.commit('old tree', timestamp=315532800)
1370
1372
        tree.rename_one('oldname', 'newname')
1371
1373
        tree.rename_one('oldname2', 'newname2')
1372
1374
        self.build_tree_contents([('tree/newname', 'newcontent')])
1384
1386
        old_path, new_path = diff_obj._prepare_files('file-id', 'oldname',
1385
1387
                                                     'newname')
1386
1388
        self.assertContainsRe(old_path, 'old/oldname$')
1387
 
        self.assertEqual(0, os.stat(old_path).st_mtime)
 
1389
        self.assertEqual(315532800, os.stat(old_path).st_mtime)
1388
1390
        self.assertContainsRe(new_path, 'tree/newname$')
1389
1391
        self.assertFileEqual('oldcontent', old_path)
1390
1392
        self.assertFileEqual('newcontent', new_path)
1394
1396
        diff_obj._prepare_files('file2-id', 'oldname2', 'newname2')
1395
1397
 
1396
1398
 
1397
 
class TestGetTreesAndBranchesToDiff(TestCaseWithTransport):
 
1399
class TestGetTreesAndBranchesToDiffLocked(TestCaseWithTransport):
 
1400
 
 
1401
    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
 
1402
        """Call get_trees_and_branches_to_diff_locked.  Overridden by
 
1403
        TestGetTreesAndBranchesToDiff.
 
1404
        """
 
1405
        return get_trees_and_branches_to_diff_locked(
 
1406
            path_list, revision_specs, old_url, new_url, self.addCleanup)
1398
1407
 
1399
1408
    def test_basic(self):
1400
1409
        tree = self.make_branch_and_tree('tree')
1401
1410
        (old_tree, new_tree,
1402
1411
         old_branch, new_branch,
1403
 
         specific_files, extra_trees) = \
1404
 
            get_trees_and_branches_to_diff(['tree'], None, None, None)
 
1412
         specific_files, extra_trees) = self.call_gtabtd(
 
1413
             ['tree'], None, None, None)
1405
1414
 
1406
1415
        self.assertIsInstance(old_tree, RevisionTree)
1407
 
        #print dir (old_tree)
1408
1416
        self.assertEqual(_mod_revision.NULL_REVISION, old_tree.get_revision_id())
1409
1417
        self.assertEqual(tree.basedir, new_tree.basedir)
1410
1418
        self.assertEqual(tree.branch.base, old_branch.base)
1424
1432
                     RevisionSpec.from_string('2')]
1425
1433
        (old_tree, new_tree,
1426
1434
         old_branch, new_branch,
1427
 
         specific_files, extra_trees) = \
1428
 
            get_trees_and_branches_to_diff(['tree'], revisions, None, None)
 
1435
         specific_files, extra_trees) = self.call_gtabtd(
 
1436
            ['tree'], revisions, None, None)
1429
1437
 
1430
1438
        self.assertIsInstance(old_tree, RevisionTree)
1431
1439
        self.assertEqual("old-id", old_tree.get_revision_id())
1435
1443
        self.assertEqual(tree.branch.base, new_branch.base)
1436
1444
        self.assertIs(None, specific_files)
1437
1445
        self.assertEqual(tree.basedir, extra_trees[0].basedir)
 
1446
 
 
1447
 
 
1448
class TestGetTreesAndBranchesToDiff(TestGetTreesAndBranchesToDiffLocked):
 
1449
    """Apply the tests for get_trees_and_branches_to_diff_locked to the
 
1450
    deprecated get_trees_and_branches_to_diff function.
 
1451
    """
 
1452
 
 
1453
    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
 
1454
        return self.applyDeprecated(
 
1455
            deprecated_in((2, 2, 0)), get_trees_and_branches_to_diff,
 
1456
            path_list, revision_specs, old_url, new_url)
 
1457