/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/blackbox/test_annotate.py

  • Committer: Jelmer Vernooij
  • Date: 2018-03-24 17:48:04 UTC
  • mfrom: (6921 work)
  • mto: This revision was merged to the branch mainline in revision 6923.
  • Revision ID: jelmer@jelmer.uk-20180324174804-xf22o05byoj12x1q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        super(TestAnnotate, self).setUp()
40
40
        wt = self.make_branch_and_tree('.')
41
41
        b = wt.branch
42
 
        self.build_tree_contents([('hello.txt', b'my helicopter\n'),
43
 
                                  ('nomail.txt', b'nomail\n')])
 
42
        self.build_tree_contents([('hello.txt', 'my helicopter\n'),
 
43
                                  ('nomail.txt', 'nomail\n')])
44
44
        wt.add(['hello.txt'])
45
45
        self.revision_id_1 = wt.commit('add hello',
46
46
                              committer='test@user',
49
49
        self.revision_id_2 = wt.commit('add nomail',
50
50
                              committer='no mail',
51
51
                              timestamp=1165970000.00, timezone=0)
52
 
        self.build_tree_contents([('hello.txt', b'my helicopter\n'
53
 
                                                b'your helicopter\n')])
 
52
        self.build_tree_contents([('hello.txt', 'my helicopter\n'
 
53
                                                'your helicopter\n')])
54
54
        self.revision_id_3 = wt.commit('mod hello',
55
55
                              committer='user@test',
56
56
                              timestamp=1166040000.00, timezone=0)
57
 
        self.build_tree_contents([('hello.txt', b'my helicopter\n'
58
 
                                                b'your helicopter\n'
59
 
                                                b'all of\n'
60
 
                                                b'our helicopters\n'
 
57
        self.build_tree_contents([('hello.txt', 'my helicopter\n'
 
58
                                                'your helicopter\n'
 
59
                                                'all of\n'
 
60
                                                'our helicopters\n'
61
61
                                  )])
62
62
        self.revision_id_4 = wt.commit('mod hello',
63
63
                              committer='user@test',
159
159
        """Create a tree with a locally edited file."""
160
160
        tree = self.make_branch_and_tree(relpath)
161
161
        file_relpath = joinpath(relpath, 'file')
162
 
        self.build_tree_contents([(file_relpath, b'foo\ngam\n')])
 
162
        self.build_tree_contents([(file_relpath, 'foo\ngam\n')])
163
163
        tree.add('file')
164
164
        tree.commit('add file', committer="test@host", rev_id="rev1")
165
 
        self.build_tree_contents([(file_relpath, b'foo\nbar\ngam\n')])
 
165
        self.build_tree_contents([(file_relpath, 'foo\nbar\ngam\n')])
166
166
        return tree
167
167
 
168
168
    def test_annotate_cmd_revspec_branch(self):
214
214
    def _create_merged_file(self):
215
215
        """Create a file with a pending merge and local edit."""
216
216
        tree = self.make_branch_and_tree('.')
217
 
        self.build_tree_contents([('file', b'foo\ngam\n')])
 
217
        self.build_tree_contents([('file', 'foo\ngam\n')])
218
218
        tree.add('file')
219
219
        tree.commit('add file', rev_id="rev1", committer="test@host")
220
220
        # right side
221
 
        self.build_tree_contents([('file', b'foo\nbar\ngam\n')])
 
221
        self.build_tree_contents([('file', 'foo\nbar\ngam\n')])
222
222
        tree.commit("right", rev_id="rev1.1.1", committer="test@host")
223
223
        tree.pull(tree.branch, True, "rev1")
224
224
        # left side
225
 
        self.build_tree_contents([('file', b'foo\nbaz\ngam\n')])
 
225
        self.build_tree_contents([('file', 'foo\nbaz\ngam\n')])
226
226
        tree.commit("left", rev_id="rev2", committer="test@host")
227
227
        # merge
228
228
        tree.merge_from_branch(tree.branch, "rev1.1.1")
229
229
        # edit the file to be 'resolved' and have a further local edit
230
 
        self.build_tree_contents([('file', b'local\nfoo\nbar\nbaz\ngam\n')])
 
230
        self.build_tree_contents([('file', 'local\nfoo\nbar\nbaz\ngam\n')])
231
231
        return tree
232
232
 
233
233
    def test_annotated_edited_merged_file_revnos(self):
256
256
 
257
257
    def test_annotate_empty_file(self):
258
258
        tree = self.make_branch_and_tree('.')
259
 
        self.build_tree_contents([('empty', b'')])
 
259
        self.build_tree_contents([('empty', '')])
260
260
        tree.add('empty')
261
261
        tree.commit('add empty file')
262
262
        out, err = self.run_bzr(['annotate', 'empty'])
264
264
 
265
265
    def test_annotate_removed_file(self):
266
266
        tree = self.make_branch_and_tree('.')
267
 
        self.build_tree_contents([('empty', b'')])
 
267
        self.build_tree_contents([('empty', '')])
268
268
        tree.add('empty')
269
269
        tree.commit('add empty file')
270
270
        # delete the file.
275
275
 
276
276
    def test_annotate_empty_file_show_ids(self):
277
277
        tree = self.make_branch_and_tree('.')
278
 
        self.build_tree_contents([('empty', b'')])
 
278
        self.build_tree_contents([('empty', '')])
279
279
        tree.add('empty')
280
280
        tree.commit('add empty file')
281
281
        out, err = self.run_bzr(['annotate', '--show-ids', 'empty'])
292
292
 
293
293
    def test_annotate_without_workingtree(self):
294
294
        tree = self.make_branch_and_tree('.')
295
 
        self.build_tree_contents([('empty', b'')])
 
295
        self.build_tree_contents([('empty', '')])
296
296
        tree.add('empty')
297
297
        tree.commit('add empty file')
298
298
        bzrdir = tree.branch.controldir
304
304
    def test_annotate_directory(self):
305
305
        """Test --directory option"""
306
306
        wt = self.make_branch_and_tree('a')
307
 
        self.build_tree_contents([('a/hello.txt', b'my helicopter\n')])
 
307
        self.build_tree_contents([('a/hello.txt', 'my helicopter\n')])
308
308
        wt.add(['hello.txt'])
309
309
        wt.commit('commit', committer='test@user')
310
310
        out, err = self.run_bzr(['annotate', '-d', 'a', 'hello.txt'])
316
316
    def test_simple_annotate(self):
317
317
        self.setup_smart_server_with_call_log()
318
318
        wt = self.make_branch_and_tree('branch')
319
 
        self.build_tree_contents([('branch/hello.txt', b'my helicopter\n')])
 
319
        self.build_tree_contents([('branch/hello.txt', 'my helicopter\n')])
320
320
        wt.add(['hello.txt'])
321
321
        wt.commit('commit', committer='test@user')
322
322
        self.reset_smart_call_log()