/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_commit.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:
16
16
 
17
17
 
18
18
import os
 
19
from io import BytesIO
19
20
 
20
21
import breezy
21
22
from .. import (
22
23
    config,
23
24
    controldir,
24
25
    errors,
 
26
    trace,
25
27
    )
26
28
from ..branch import Branch
27
29
from ..bzr.bzrdir import BzrDirMetaFormat1
676
678
        finally:
677
679
            basis.unlock()
678
680
 
 
681
    def test_unsupported_symlink_commit(self):
 
682
        self.requireFeature(SymlinkFeature)
 
683
        tree = self.make_branch_and_tree('.')
 
684
        self.build_tree(['hello'])
 
685
        tree.add('hello')
 
686
        tree.commit('added hello', rev_id=b'hello_id')
 
687
        os.symlink('hello', 'foo')
 
688
        tree.add('foo')
 
689
        tree.commit('added foo', rev_id=b'foo_id')
 
690
        log = BytesIO()
 
691
        trace.push_log_file(log)
 
692
        os_symlink = getattr(os, 'symlink', None)
 
693
        os.symlink = None
 
694
        try:
 
695
            # At this point as bzr thinks symlinks are not supported
 
696
            # we should get a warning about symlink foo and bzr should
 
697
            # not think its removed.
 
698
            os.unlink('foo')
 
699
            self.build_tree(['world'])
 
700
            tree.add('world')
 
701
            tree.commit('added world', rev_id=b'world_id')
 
702
        finally:
 
703
            if os_symlink:
 
704
                os.symlink = os_symlink
 
705
        self.assertContainsRe(
 
706
            log.getvalue(),
 
707
            b'Ignoring "foo" as symlinks are not '
 
708
            b'supported on this filesystem\\.')
 
709
 
679
710
    def test_commit_kind_changes(self):
680
711
        self.requireFeature(SymlinkFeature)
681
712
        tree = self.make_branch_and_tree('.')