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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-06-07 17:52:38 UTC
  • mfrom: (6977.1.2 remove-dir)
  • Revision ID: breezy.the.bot@gmail.com-20180607175238-wyibx0clcs78m770
Deal with missing files correctly in 'bzr status' in git trees.

Merged from https://code.launchpad.net/~jelmer/brz/remove-dir/+merge/347631

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    ZERO_SHA,
29
29
    )
30
30
 
31
 
from .... import conflicts as _mod_conflicts
 
31
from .... import (
 
32
    conflicts as _mod_conflicts,
 
33
    )
 
34
from ....delta import TreeDelta
 
35
from ..mapping import (
 
36
    default_mapping,
 
37
    GitFileIdMap,
 
38
    )
32
39
from ..tree import (
33
40
    changes_between_git_tree_and_working_copy,
 
41
    tree_delta_from_git_changes,
34
42
    )
35
43
from ..workingtree import (
36
44
    FLAG_STAGEMASK,
37
45
    )
38
 
from ....tests import TestCaseWithTransport
 
46
from ....tests import (
 
47
    TestCase,
 
48
    TestCaseWithTransport,
 
49
    )
39
50
 
40
51
 
41
52
class GitWorkingTreeTests(TestCaseWithTransport):
66
77
        self.assertFalse(self.tree.is_versioned('a'))
67
78
 
68
79
 
 
80
class TreeDeltaFromGitChangesTests(TestCase):
 
81
 
 
82
    def test_empty(self):
 
83
        delta = TreeDelta()
 
84
        changes = []
 
85
        self.assertEqual(
 
86
            delta,
 
87
            tree_delta_from_git_changes(changes, default_mapping,
 
88
                (GitFileIdMap({}, default_mapping),
 
89
                 GitFileIdMap({}, default_mapping))))
 
90
 
 
91
    def test_missing(self):
 
92
        delta = TreeDelta()
 
93
        delta.removed.append(('a', 'a-id', 'file'))
 
94
        changes = [(('a', 'a'), (stat.S_IFREG | 0o755, 0), ('a' * 40, 'a' * 40))]
 
95
        self.assertEqual(
 
96
            delta,
 
97
            tree_delta_from_git_changes(changes, default_mapping,
 
98
                (GitFileIdMap({'a': 'a-id'}, default_mapping),
 
99
                 GitFileIdMap({'a': 'a-id'}, default_mapping))))
 
100
 
 
101
 
69
102
class ChangesBetweenGitTreeAndWorkingCopyTests(TestCaseWithTransport):
70
103
 
71
104
    def setUp(self):