/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 breezy/tests/test_workingtree.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-06-04 00:08:59 UTC
  • mfrom: (7122.6.12 win-symlink-warning)
  • Revision ID: breezy.the.bot@gmail.com-20190604000859-2xwms4tkctrj83dm
Allow symbolic links to exist when checking out trees on Windows.

Merged from https://code.launchpad.net/~jelmer/brz/win-symlink-warning/+merge/363900

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
 
18
from io import BytesIO
 
19
import os
 
20
 
18
21
from .. import (
19
22
    conflicts,
20
23
    errors,
 
24
    trace,
21
25
    transport,
22
26
    workingtree,
23
27
    )
37
41
    TreeLink,
38
42
    )
39
43
 
 
44
from .features import SymlinkFeature
40
45
 
41
46
class TestTreeDirectory(TestCaseWithTransport):
42
47
 
443
448
                         resolved)
444
449
        self.assertPathDoesNotExist('this/hello.BASE')
445
450
 
 
451
    def test_unsupported_symlink_auto_resolve(self):
 
452
        self.requireFeature(SymlinkFeature)
 
453
        base = self.make_branch_and_tree('base')
 
454
        self.build_tree_contents([('base/hello', 'Hello')])
 
455
        base.add('hello', b'hello_id')
 
456
        base.commit('commit 0')
 
457
        other = base.controldir.sprout('other').open_workingtree()
 
458
        self.build_tree_contents([('other/hello', 'Hello')])
 
459
        os.symlink('other/hello', 'other/foo')
 
460
        other.add('foo', b'foo_id')
 
461
        other.commit('commit symlink')
 
462
        this = base.controldir.sprout('this').open_workingtree()
 
463
        self.assertPathExists('this/hello')
 
464
        self.build_tree_contents([('this/hello', 'Hello')])
 
465
        this.commit('commit 2')
 
466
        log = BytesIO()
 
467
        trace.push_log_file(log)
 
468
        os_symlink = getattr(os, 'symlink', None)
 
469
        os.symlink = None
 
470
        try:
 
471
            this.merge_from_branch(other.branch)
 
472
        finally:
 
473
            if os_symlink:
 
474
                os.symlink = os_symlink
 
475
        self.assertContainsRe(
 
476
            log.getvalue(),
 
477
            b'Unable to create symlink "foo" on this filesystem')
 
478
 
446
479
    def test_auto_resolve_dir(self):
447
480
        tree = self.make_branch_and_tree('tree')
448
481
        self.build_tree(['tree/hello/'])