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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-16 18:59:44 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • Revision ID: breezy.the.bot@gmail.com-20181116185944-biefv1sub37qfybm
Sprinkle some PEP8iness.

Merged from https://code.launchpad.net/~jelmer/brz/more-cleanups/+merge/358611

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
    def test_conflict_list(self):
60
60
        self.assertIsInstance(
61
 
                self.tree.conflicts(),
62
 
                _mod_conflicts.ConflictList)
 
61
            self.tree.conflicts(),
 
62
            _mod_conflicts.ConflictList)
63
63
 
64
64
    def test_add_conflict(self):
65
65
        self.build_tree(['conflicted'])
66
66
        self.tree.add(['conflicted'])
67
67
        with self.tree.lock_tree_write():
68
 
            self.tree.index[b'conflicted'] = self.tree.index[b'conflicted'][:9] + (FLAG_STAGEMASK, )
 
68
            self.tree.index[b'conflicted'] = self.tree.index[b'conflicted'][:9] + \
 
69
                (FLAG_STAGEMASK, )
69
70
            self.tree._index_dirty = True
70
71
        conflicts = self.tree.conflicts()
71
72
        self.assertEqual(1, len(conflicts))
94
95
    def setUp(self):
95
96
        super(GitWorkingTreeFileTests, self).setUp()
96
97
        self.tree = self.make_branch_and_tree('actual', format="git")
97
 
        self.build_tree_contents([('linked/',), ('linked/.git', 'gitdir: ../actual/.git')])
 
98
        self.build_tree_contents(
 
99
            [('linked/',), ('linked/.git', 'gitdir: ../actual/.git')])
98
100
        self.wt = _mod_workingtree.WorkingTree.open('linked')
99
101
 
100
102
    def test_add(self):
111
113
        self.assertEqual(
112
114
            delta,
113
115
            tree_delta_from_git_changes(changes, default_mapping,
114
 
                (GitFileIdMap({}, default_mapping),
115
 
                 GitFileIdMap({}, default_mapping))))
 
116
                                        (GitFileIdMap({}, default_mapping),
 
117
                                         GitFileIdMap({}, default_mapping))))
116
118
 
117
119
    def test_missing(self):
118
120
        delta = TreeDelta()
119
121
        delta.removed.append(('a', b'a-id', 'file'))
120
 
        changes = [((b'a', b'a'), (stat.S_IFREG | 0o755, 0), (b'a' * 40, b'a' * 40))]
 
122
        changes = [((b'a', b'a'), (stat.S_IFREG | 0o755, 0),
 
123
                    (b'a' * 40, b'a' * 40))]
121
124
        self.assertEqual(
122
125
            delta,
123
126
            tree_delta_from_git_changes(changes, default_mapping,
124
 
                (GitFileIdMap({u'a': b'a-id'}, default_mapping),
125
 
                 GitFileIdMap({u'a': b'a-id'}, default_mapping))))
 
127
                                        (GitFileIdMap({u'a': b'a-id'}, default_mapping),
 
128
                                         GitFileIdMap({u'a': b'a-id'}, default_mapping))))
126
129
 
127
130
 
128
131
class ChangesBetweenGitTreeAndWorkingCopyTests(TestCaseWithTransport):
197
200
        newt = Tree()
198
201
        newt.add(b"a", 0, ZERO_SHA)
199
202
        self.expectDelta(
200
 
                [((b'', b''), (stat.S_IFDIR, stat.S_IFDIR), (oldt.id, newt.id)),
201
 
                 ((b'a', b'a'), (stat.S_IFREG|0o644, 0), (a.id, ZERO_SHA))])
 
203
            [((b'', b''), (stat.S_IFDIR, stat.S_IFDIR), (oldt.id, newt.id)),
 
204
             ((b'a', b'a'), (stat.S_IFREG | 0o644, 0), (a.id, ZERO_SHA))])
202
205
 
203
206
    def test_versioned_replace_by_dir(self):
204
207
        self.build_tree(['a'])
214
217
        newt.add(b"a", stat.S_IFDIR, newa.id)
215
218
        self.expectDelta([
216
219
            ((b'', b''),
217
 
            (stat.S_IFDIR, stat.S_IFDIR),
218
 
            (oldt.id, newt.id)),
 
220
             (stat.S_IFDIR, stat.S_IFDIR),
 
221
             (oldt.id, newt.id)),
219
222
            ((b'a', b'a'), (stat.S_IFREG | 0o644, stat.S_IFDIR), (olda.id, newa.id))
220
223
            ], want_unversioned=False)
221
224
        self.expectDelta([
222
225
            ((b'', b''),
223
 
            (stat.S_IFDIR, stat.S_IFDIR),
224
 
            (oldt.id, newt.id)),
 
226
             (stat.S_IFDIR, stat.S_IFDIR),
 
227
             (oldt.id, newt.id)),
225
228
            ((b'a', b'a'), (stat.S_IFREG | 0o644, stat.S_IFDIR), (olda.id, newa.id))
226
229
            ], want_unversioned=True)
227
230
 
232
235
        newt.add(b"a", stat.S_IFREG | 0o644, newa.id)
233
236
        self.expectDelta([
234
237
            ((None, b''),
235
 
            (None, stat.S_IFDIR),
236
 
            (None, newt.id)),
 
238
             (None, stat.S_IFDIR),
 
239
             (None, newt.id)),
237
240
            ((None, b'a'), (None, stat.S_IFREG | 0o644), (None, newa.id))
238
241
            ], [b'a'], want_unversioned=True)