~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-29 22:03:03 UTC
  • mfrom: (5416.2.6 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100929220303-cr95h8iwtggco721
(mbp) Add 'break-lock --force'

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
33
33
    transform,
34
34
    )
35
35
from bzrlib.symbol_versioning import deprecated_in
36
 
from bzrlib.tests import features, EncodingAdapter
 
36
from bzrlib.tests import features
37
37
from bzrlib.tests.blackbox.test_diff import subst_dates
38
 
from bzrlib.tests import (
39
 
    features,
40
 
    )
 
38
 
 
39
 
 
40
class _AttribFeature(tests.Feature):
 
41
 
 
42
    def _probe(self):
 
43
        if (sys.platform not in ('cygwin', 'win32')):
 
44
            return False
 
45
        try:
 
46
            proc = subprocess.Popen(['attrib', '.'], stdout=subprocess.PIPE)
 
47
        except OSError, e:
 
48
            return False
 
49
        return (0 == proc.wait())
 
50
 
 
51
    def feature_name(self):
 
52
        return 'attrib Windows command-line tool'
 
53
 
 
54
AttribFeature = _AttribFeature()
 
55
 
 
56
 
 
57
compiled_patiencediff_feature = tests.ModuleAvailableFeature(
 
58
                                    'bzrlib._patiencediff_c')
41
59
 
42
60
 
43
61
def udiff_lines(old, new, allow_binary=False):
126
144
        self.check_patch(lines)
127
145
 
128
146
    def test_external_diff_binary_lang_c(self):
 
147
        old_env = {}
129
148
        for lang in ('LANG', 'LC_ALL', 'LANGUAGE'):
130
 
            self.overrideEnv(lang, 'C')
131
 
        lines = external_udiff_lines(['\x00foobar\n'], ['foo\x00bar\n'])
132
 
        # Older versions of diffutils say "Binary files", newer
133
 
        # versions just say "Files".
134
 
        self.assertContainsRe(lines[0], '(Binary f|F)iles old and new differ\n')
135
 
        self.assertEquals(lines[1:], ['\n'])
 
149
            old_env[lang] = osutils.set_or_unset_env(lang, 'C')
 
150
        try:
 
151
            lines = external_udiff_lines(['\x00foobar\n'], ['foo\x00bar\n'])
 
152
            # Older versions of diffutils say "Binary files", newer
 
153
            # versions just say "Files".
 
154
            self.assertContainsRe(lines[0],
 
155
                                  '(Binary f|F)iles old and new differ\n')
 
156
            self.assertEquals(lines[1:], ['\n'])
 
157
        finally:
 
158
            for lang, old_val in old_env.iteritems():
 
159
                osutils.set_or_unset_env(lang, old_val)
136
160
 
137
161
    def test_no_external_diff(self):
138
162
        """Check that NoDiff is raised when diff is not available"""
139
 
        # Make sure no 'diff' command is available
140
 
        # XXX: Weird, using None instead of '' breaks the test -- vila 20101216
141
 
        self.overrideEnv('PATH', '')
142
 
        self.assertRaises(errors.NoDiff, diff.external_diff,
143
 
                          'old', ['boo\n'], 'new', ['goo\n'],
144
 
                          StringIO(), diff_opts=['-u'])
 
163
        # Use os.environ['PATH'] to make sure no 'diff' command is available
 
164
        orig_path = os.environ['PATH']
 
165
        try:
 
166
            os.environ['PATH'] = ''
 
167
            self.assertRaises(errors.NoDiff, diff.external_diff,
 
168
                              'old', ['boo\n'], 'new', ['goo\n'],
 
169
                              StringIO(), diff_opts=['-u'])
 
170
        finally:
 
171
            os.environ['PATH'] = orig_path
145
172
 
146
173
    def test_internal_diff_default(self):
147
174
        # Default internal diff encoding is utf8
208
235
        output = StringIO.StringIO()
209
236
        diff.internal_diff(u'old_\xb5', ['old_text\n'],
210
237
                            u'new_\xe5', ['new_text\n'], output)
211
 
        self.assertIsInstance(output.getvalue(), str,
 
238
        self.failUnless(isinstance(output.getvalue(), str),
212
239
            'internal_diff should return bytestrings')
213
240
 
214
 
    def test_internal_diff_default_context(self):
215
 
        output = StringIO()
216
 
        diff.internal_diff('old', ['same_text\n','same_text\n','same_text\n',
217
 
                           'same_text\n','same_text\n','old_text\n'],
218
 
                           'new', ['same_text\n','same_text\n','same_text\n',
219
 
                           'same_text\n','same_text\n','new_text\n'], output)
220
 
        lines = output.getvalue().splitlines(True)
221
 
        self.check_patch(lines)
222
 
        self.assertEquals(['--- old\n',
223
 
                           '+++ new\n',
224
 
                           '@@ -3,4 +3,4 @@\n',
225
 
                           ' same_text\n',
226
 
                           ' same_text\n',
227
 
                           ' same_text\n',
228
 
                           '-old_text\n',
229
 
                           '+new_text\n',
230
 
                           '\n',
231
 
                          ]
232
 
                          , lines)
233
 
 
234
 
    def test_internal_diff_no_context(self):
235
 
        output = StringIO()
236
 
        diff.internal_diff('old', ['same_text\n','same_text\n','same_text\n',
237
 
                           'same_text\n','same_text\n','old_text\n'],
238
 
                           'new', ['same_text\n','same_text\n','same_text\n',
239
 
                           'same_text\n','same_text\n','new_text\n'], output,
240
 
                           context_lines=0)
241
 
        lines = output.getvalue().splitlines(True)
242
 
        self.check_patch(lines)
243
 
        self.assertEquals(['--- old\n',
244
 
                           '+++ new\n',
245
 
                           '@@ -6,1 +6,1 @@\n',
246
 
                           '-old_text\n',
247
 
                           '+new_text\n',
248
 
                           '\n',
249
 
                          ]
250
 
                          , lines)
251
 
 
252
 
    def test_internal_diff_more_context(self):
253
 
        output = StringIO()
254
 
        diff.internal_diff('old', ['same_text\n','same_text\n','same_text\n',
255
 
                           'same_text\n','same_text\n','old_text\n'],
256
 
                           'new', ['same_text\n','same_text\n','same_text\n',
257
 
                           'same_text\n','same_text\n','new_text\n'], output,
258
 
                           context_lines=4)
259
 
        lines = output.getvalue().splitlines(True)
260
 
        self.check_patch(lines)
261
 
        self.assertEquals(['--- old\n',
262
 
                           '+++ new\n',
263
 
                           '@@ -2,5 +2,5 @@\n',
264
 
                           ' same_text\n',
265
 
                           ' same_text\n',
266
 
                           ' same_text\n',
267
 
                           ' same_text\n',
268
 
                           '-old_text\n',
269
 
                           '+new_text\n',
270
 
                           '\n',
271
 
                          ]
272
 
                          , lines)
273
 
 
274
 
 
275
 
 
276
 
 
277
241
 
278
242
class TestDiffFiles(tests.TestCaseInTempDir):
279
243
 
283
247
        lines = external_udiff_lines(['\x00foobar\n'], ['foo\x00bar\n'])
284
248
 
285
249
        cmd = ['diff', '-u', '--binary', 'old', 'new']
286
 
        with open('old', 'wb') as f: f.write('\x00foobar\n')
287
 
        with open('new', 'wb') as f: f.write('foo\x00bar\n')
 
250
        open('old', 'wb').write('\x00foobar\n')
 
251
        open('new', 'wb').write('foo\x00bar\n')
288
252
        pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE,
289
253
                                     stdin=subprocess.PIPE)
290
254
        out, err = pipe.communicate()
294
258
        self.assertEqual(out.splitlines(True) + ['\n'], lines)
295
259
 
296
260
 
297
 
def get_diff_as_string(tree1, tree2, specific_files=None, working_tree=None):
298
 
    output = StringIO()
299
 
    if working_tree is not None:
300
 
        extra_trees = (working_tree,)
301
 
    else:
302
 
        extra_trees = ()
303
 
    diff.show_diff_trees(tree1, tree2, output,
304
 
        specific_files=specific_files,
305
 
        extra_trees=extra_trees, old_label='old/',
306
 
        new_label='new/')
307
 
    return output.getvalue()
308
 
 
309
 
 
310
 
class TestDiffDates(tests.TestCaseWithTransport):
 
261
class TestShowDiffTreesHelper(tests.TestCaseWithTransport):
 
262
    """Has a helper for running show_diff_trees"""
 
263
 
 
264
    def get_diff(self, tree1, tree2, specific_files=None, working_tree=None):
 
265
        output = StringIO()
 
266
        if working_tree is not None:
 
267
            extra_trees = (working_tree,)
 
268
        else:
 
269
            extra_trees = ()
 
270
        diff.show_diff_trees(tree1, tree2, output,
 
271
                             specific_files=specific_files,
 
272
                             extra_trees=extra_trees, old_label='old/',
 
273
                             new_label='new/')
 
274
        return output.getvalue()
 
275
 
 
276
 
 
277
class TestDiffDates(TestShowDiffTreesHelper):
311
278
 
312
279
    def setUp(self):
313
280
        super(TestDiffDates, self).setUp()
348
315
        os.utime('file1', (1144195200, 1144195200)) # 2006-04-05 00:00:00 UTC
349
316
 
350
317
    def test_diff_rev_tree_working_tree(self):
351
 
        output = get_diff_as_string(self.wt.basis_tree(), self.wt)
 
318
        output = self.get_diff(self.wt.basis_tree(), self.wt)
352
319
        # note that the date for old/file1 is from rev 2 rather than from
353
320
        # the basis revision (rev 4)
354
321
        self.assertEqualDiff(output, '''\
364
331
    def test_diff_rev_tree_rev_tree(self):
365
332
        tree1 = self.b.repository.revision_tree('rev-2')
366
333
        tree2 = self.b.repository.revision_tree('rev-3')
367
 
        output = get_diff_as_string(tree1, tree2)
 
334
        output = self.get_diff(tree1, tree2)
368
335
        self.assertEqualDiff(output, '''\
369
336
=== modified file 'file2'
370
337
--- old/file2\t2006-04-01 00:00:00 +0000
378
345
    def test_diff_add_files(self):
379
346
        tree1 = self.b.repository.revision_tree(_mod_revision.NULL_REVISION)
380
347
        tree2 = self.b.repository.revision_tree('rev-1')
381
 
        output = get_diff_as_string(tree1, tree2)
 
348
        output = self.get_diff(tree1, tree2)
382
349
        # the files have the epoch time stamp for the tree in which
383
350
        # they don't exist.
384
351
        self.assertEqualDiff(output, '''\
399
366
    def test_diff_remove_files(self):
400
367
        tree1 = self.b.repository.revision_tree('rev-3')
401
368
        tree2 = self.b.repository.revision_tree('rev-4')
402
 
        output = get_diff_as_string(tree1, tree2)
 
369
        output = self.get_diff(tree1, tree2)
403
370
        # the file has the epoch time stamp for the tree in which
404
371
        # it doesn't exist.
405
372
        self.assertEqualDiff(output, '''\
416
383
        self.wt.rename_one('file1', 'file1b')
417
384
        old_tree = self.b.repository.revision_tree('rev-1')
418
385
        new_tree = self.b.repository.revision_tree('rev-4')
419
 
        out = get_diff_as_string(old_tree, new_tree, specific_files=['file1b'],
 
386
        out = self.get_diff(old_tree, new_tree, specific_files=['file1b'],
420
387
                            working_tree=self.wt)
421
388
        self.assertContainsRe(out, 'file1\t')
422
389
 
428
395
        self.wt.rename_one('file1', 'dir1/file1')
429
396
        old_tree = self.b.repository.revision_tree('rev-1')
430
397
        new_tree = self.b.repository.revision_tree('rev-4')
431
 
        out = get_diff_as_string(old_tree, new_tree, specific_files=['dir1'],
 
398
        out = self.get_diff(old_tree, new_tree, specific_files=['dir1'],
432
399
                            working_tree=self.wt)
433
400
        self.assertContainsRe(out, 'file1\t')
434
 
        out = get_diff_as_string(old_tree, new_tree, specific_files=['dir2'],
 
401
        out = self.get_diff(old_tree, new_tree, specific_files=['dir2'],
435
402
                            working_tree=self.wt)
436
403
        self.assertNotContainsRe(out, 'file1\t')
437
404
 
438
405
 
439
 
class TestShowDiffTrees(tests.TestCaseWithTransport):
 
406
 
 
407
class TestShowDiffTrees(TestShowDiffTreesHelper):
440
408
    """Direct tests for show_diff_trees"""
441
409
 
442
410
    def test_modified_file(self):
447
415
        tree.commit('one', rev_id='rev-1')
448
416
 
449
417
        self.build_tree_contents([('tree/file', 'new contents\n')])
450
 
        d = get_diff_as_string(tree.basis_tree(), tree)
 
418
        d = self.get_diff(tree.basis_tree(), tree)
451
419
        self.assertContainsRe(d, "=== modified file 'file'\n")
452
420
        self.assertContainsRe(d, '--- old/file\t')
453
421
        self.assertContainsRe(d, '\\+\\+\\+ new/file\t')
464
432
 
465
433
        tree.rename_one('dir', 'other')
466
434
        self.build_tree_contents([('tree/other/file', 'new contents\n')])
467
 
        d = get_diff_as_string(tree.basis_tree(), tree)
 
435
        d = self.get_diff(tree.basis_tree(), tree)
468
436
        self.assertContainsRe(d, "=== renamed directory 'dir' => 'other'\n")
469
437
        self.assertContainsRe(d, "=== modified file 'other/file'\n")
470
438
        # XXX: This is technically incorrect, because it used to be at another
483
451
        tree.commit('one', rev_id='rev-1')
484
452
 
485
453
        tree.rename_one('dir', 'newdir')
486
 
        d = get_diff_as_string(tree.basis_tree(), tree)
 
454
        d = self.get_diff(tree.basis_tree(), tree)
487
455
        # Renaming a directory should be a single "you renamed this dir" even
488
456
        # when there are files inside.
489
457
        self.assertEqual(d, "=== renamed directory 'dir' => 'newdir'\n")
496
464
        tree.commit('one', rev_id='rev-1')
497
465
 
498
466
        tree.rename_one('file', 'newname')
499
 
        d = get_diff_as_string(tree.basis_tree(), tree)
 
467
        d = self.get_diff(tree.basis_tree(), tree)
500
468
        self.assertContainsRe(d, "=== renamed file 'file' => 'newname'\n")
501
469
        # We shouldn't have a --- or +++ line, because there is no content
502
470
        # change
511
479
 
512
480
        tree.rename_one('file', 'newname')
513
481
        self.build_tree_contents([('tree/newname', 'new contents\n')])
514
 
        d = get_diff_as_string(tree.basis_tree(), tree)
 
482
        d = self.get_diff(tree.basis_tree(), tree)
515
483
        self.assertContainsRe(d, "=== renamed file 'file' => 'newname'\n")
516
484
        self.assertContainsRe(d, '--- old/file\t')
517
485
        self.assertContainsRe(d, '\\+\\+\\+ new/newname\t')
541
509
        tree.rename_one('c', 'new-c')
542
510
        tree.rename_one('d', 'new-d')
543
511
 
544
 
        d = get_diff_as_string(tree.basis_tree(), tree)
 
512
        d = self.get_diff(tree.basis_tree(), tree)
545
513
 
546
514
        self.assertContainsRe(d, r"file 'a'.*\(properties changed:"
547
515
                                  ".*\+x to -x.*\)")
559
527
        is a binary file in the diff.
560
528
        """
561
529
        # See https://bugs.launchpad.net/bugs/110092.
562
 
        self.requireFeature(features.UnicodeFilenameFeature)
 
530
        self.requireFeature(tests.UnicodeFilenameFeature)
563
531
 
564
532
        # This bug isn't triggered with cStringIO.
565
533
        from StringIO import StringIO
584
552
 
585
553
    def test_unicode_filename(self):
586
554
        """Test when the filename are unicode."""
587
 
        self.requireFeature(features.UnicodeFilenameFeature)
 
555
        self.requireFeature(tests.UnicodeFilenameFeature)
588
556
 
589
557
        alpha, omega = u'\u03b1', u'\u03c9'
590
558
        autf8, outf8 = alpha.encode('utf8'), omega.encode('utf8')
605
573
        tree.add(['add_'+alpha], ['file-id'])
606
574
        self.build_tree_contents([('tree/mod_'+alpha, 'contents_mod\n')])
607
575
 
608
 
        d = get_diff_as_string(tree.basis_tree(), tree)
 
576
        d = self.get_diff(tree.basis_tree(), tree)
609
577
        self.assertContainsRe(d,
610
578
                "=== renamed file 'ren_%s' => 'ren_%s'\n"%(autf8, outf8))
611
579
        self.assertContainsRe(d, "=== added file 'add_%s'"%autf8)
616
584
        """Test for bug #382699: unicode filenames on Windows should be shown
617
585
        in user encoding.
618
586
        """
619
 
        self.requireFeature(features.UnicodeFilenameFeature)
 
587
        self.requireFeature(tests.UnicodeFilenameFeature)
620
588
        # The word 'test' in Russian
621
589
        _russian_test = u'\u0422\u0435\u0441\u0442'
622
590
        directory = _russian_test + u'/'
753
721
             ' \@\@\n-old\n\+new\n\n')
754
722
 
755
723
    def test_diff_kind_change(self):
756
 
        self.requireFeature(features.SymlinkFeature)
 
724
        self.requireFeature(tests.SymlinkFeature)
757
725
        self.build_tree_contents([('old-tree/olddir/',),
758
726
                                  ('old-tree/olddir/oldfile', 'old\n')])
759
727
        self.old_tree.add('olddir')
1217
1185
 
1218
1186
class TestPatienceDiffLib_c(TestPatienceDiffLib):
1219
1187
 
1220
 
    _test_needs_features = [features.compiled_patiencediff_feature]
 
1188
    _test_needs_features = [compiled_patiencediff_feature]
1221
1189
 
1222
1190
    def setUp(self):
1223
1191
        super(TestPatienceDiffLib_c, self).setUp()
1254
1222
                 'how are you today?\n']
1255
1223
        txt_b = ['hello there\n',
1256
1224
                 'how are you today?\n']
1257
 
        with open('a1', 'wb') as f: f.writelines(txt_a)
1258
 
        with open('b1', 'wb') as f: f.writelines(txt_b)
 
1225
        open('a1', 'wb').writelines(txt_a)
 
1226
        open('b1', 'wb').writelines(txt_b)
1259
1227
 
1260
1228
        unified_diff_files = patiencediff.unified_diff_files
1261
1229
        psm = self._PatienceSequenceMatcher
1271
1239
 
1272
1240
        txt_a = map(lambda x: x+'\n', 'abcdefghijklmnop')
1273
1241
        txt_b = map(lambda x: x+'\n', 'abcdefxydefghijklmnop')
1274
 
        with open('a2', 'wb') as f: f.writelines(txt_a)
1275
 
        with open('b2', 'wb') as f: f.writelines(txt_b)
 
1242
        open('a2', 'wb').writelines(txt_a)
 
1243
        open('b2', 'wb').writelines(txt_b)
1276
1244
 
1277
1245
        # This is the result with LongestCommonSubstring matching
1278
1246
        self.assertEquals(['--- a2\n',
1313
1281
 
1314
1282
class TestPatienceDiffLibFiles_c(TestPatienceDiffLibFiles):
1315
1283
 
1316
 
    _test_needs_features = [features.compiled_patiencediff_feature]
 
1284
    _test_needs_features = [compiled_patiencediff_feature]
1317
1285
 
1318
1286
    def setUp(self):
1319
1287
        super(TestPatienceDiffLibFiles_c, self).setUp()
1325
1293
class TestUsingCompiledIfAvailable(tests.TestCase):
1326
1294
 
1327
1295
    def test_PatienceSequenceMatcher(self):
1328
 
        if features.compiled_patiencediff_feature.available():
 
1296
        if compiled_patiencediff_feature.available():
1329
1297
            from bzrlib._patiencediff_c import PatienceSequenceMatcher_c
1330
1298
            self.assertIs(PatienceSequenceMatcher_c,
1331
1299
                          patiencediff.PatienceSequenceMatcher)
1335
1303
                          patiencediff.PatienceSequenceMatcher)
1336
1304
 
1337
1305
    def test_unique_lcs(self):
1338
 
        if features.compiled_patiencediff_feature.available():
 
1306
        if compiled_patiencediff_feature.available():
1339
1307
            from bzrlib._patiencediff_c import unique_lcs_c
1340
1308
            self.assertIs(unique_lcs_c,
1341
1309
                          patiencediff.unique_lcs)
1345
1313
                          patiencediff.unique_lcs)
1346
1314
 
1347
1315
    def test_recurse_matches(self):
1348
 
        if features.compiled_patiencediff_feature.available():
 
1316
        if compiled_patiencediff_feature.available():
1349
1317
            from bzrlib._patiencediff_c import recurse_matches_c
1350
1318
            self.assertIs(recurse_matches_c,
1351
1319
                          patiencediff.recurse_matches)
1401
1369
                         ' on this machine', str(e))
1402
1370
 
1403
1371
    def test_prepare_files_creates_paths_readable_by_windows_tool(self):
1404
 
        self.requireFeature(features.AttribFeature)
 
1372
        self.requireFeature(AttribFeature)
1405
1373
        output = StringIO()
1406
1374
        tree = self.make_branch_and_tree('tree')
1407
1375
        self.build_tree_contents([('tree/file', 'content')])
1466
1434
        diff_obj._prepare_files('file2-id', 'oldname2', 'newname2')
1467
1435
 
1468
1436
 
1469
 
class TestDiffFromToolEncodedFilename(tests.TestCaseWithTransport):
1470
 
 
1471
 
    def test_encodable_filename(self):
1472
 
        # Just checks file path for external diff tool.
1473
 
        # We cannot change CPython's internal encoding used by os.exec*.
1474
 
        import sys
1475
 
        diffobj = diff.DiffFromTool(['dummy', '@old_path', '@new_path'],
1476
 
                                    None, None, None)
1477
 
        for _, scenario in EncodingAdapter.encoding_scenarios:
1478
 
            encoding = scenario['encoding']
1479
 
            dirname  = scenario['info']['directory']
1480
 
            filename = scenario['info']['filename']
1481
 
 
1482
 
            self.overrideAttr(diffobj, '_fenc', lambda: encoding)
1483
 
            relpath = dirname + u'/' + filename
1484
 
            fullpath = diffobj._safe_filename('safe', relpath)
1485
 
            self.assertEqual(
1486
 
                    fullpath,
1487
 
                    fullpath.encode(encoding).decode(encoding)
1488
 
                    )
1489
 
            self.assert_(fullpath.startswith(diffobj._root + '/safe'))
1490
 
 
1491
 
    def test_unencodable_filename(self):
1492
 
        import sys
1493
 
        diffobj = diff.DiffFromTool(['dummy', '@old_path', '@new_path'],
1494
 
                                    None, None, None)
1495
 
        for _, scenario in EncodingAdapter.encoding_scenarios:
1496
 
            encoding = scenario['encoding']
1497
 
            dirname  = scenario['info']['directory']
1498
 
            filename = scenario['info']['filename']
1499
 
 
1500
 
            if encoding == 'iso-8859-1':
1501
 
                encoding = 'iso-8859-2'
1502
 
            else:
1503
 
                encoding = 'iso-8859-1'
1504
 
 
1505
 
            self.overrideAttr(diffobj, '_fenc', lambda: encoding)
1506
 
            relpath = dirname + u'/' + filename
1507
 
            fullpath = diffobj._safe_filename('safe', relpath)
1508
 
            self.assertEqual(
1509
 
                    fullpath,
1510
 
                    fullpath.encode(encoding).decode(encoding)
1511
 
                    )
1512
 
            self.assert_(fullpath.startswith(diffobj._root + '/safe'))
1513
 
 
1514
 
 
1515
1437
class TestGetTreesAndBranchesToDiffLocked(tests.TestCaseWithTransport):
1516
1438
 
1517
1439
    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
1518
 
        """Call get_trees_and_branches_to_diff_locked."""
 
1440
        """Call get_trees_and_branches_to_diff_locked.  Overridden by
 
1441
        TestGetTreesAndBranchesToDiff.
 
1442
        """
1519
1443
        return diff.get_trees_and_branches_to_diff_locked(
1520
1444
            path_list, revision_specs, old_url, new_url, self.addCleanup)
1521
1445
 
1558
1482
        self.assertEqual(tree.branch.base, new_branch.base)
1559
1483
        self.assertIs(None, specific_files)
1560
1484
        self.assertEqual(tree.basedir, extra_trees[0].basedir)
 
1485
 
 
1486
 
 
1487
class TestGetTreesAndBranchesToDiff(TestGetTreesAndBranchesToDiffLocked):
 
1488
    """Apply the tests for get_trees_and_branches_to_diff_locked to the
 
1489
    deprecated get_trees_and_branches_to_diff function.
 
1490
    """
 
1491
 
 
1492
    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
 
1493
        return self.applyDeprecated(
 
1494
            deprecated_in((2, 2, 0)), diff.get_trees_and_branches_to_diff,
 
1495
            path_list, revision_specs, old_url, new_url)
 
1496