/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/per_workingtree/test_commit.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-06 01:18:08 UTC
  • mfrom: (7143 work)
  • mto: This revision was merged to the branch mainline in revision 7151.
  • Revision ID: jelmer@jelmer.uk-20181106011808-y870f4vq0ork3ahu
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
        if tree.branch.repository._format.supports_setting_revision_ids:
178
178
            committed_id = tree.commit('foo', rev_id=b'foo')
179
179
            # the commit should have returned the same id we asked for.
180
 
            self.assertEqual('foo', committed_id)
 
180
            self.assertEqual(b'foo', committed_id)
181
181
        else:
182
182
            committed_id = tree.commit('foo')
183
183
        self.assertEqual([committed_id], tree.get_parent_ids())
237
237
        except errors.UpgradeRequired:
238
238
            # older format.
239
239
            return
240
 
        master.controldir.transport.put_bytes('branch-format', 'garbage')
 
240
        master.controldir.transport.put_bytes('branch-format', b'garbage')
241
241
        del master
242
242
        # check its corrupted.
243
243
        self.assertRaises(errors.UnknownFormatError,
267
267
        if not wt.branch.repository._format.supports_ghosts:
268
268
            raise tests.TestNotApplicable(
269
269
                'format does not support ghosts')
270
 
        wt.set_parent_ids(['non:existent@rev--ision--0--2'],
 
270
        wt.set_parent_ids([b'non:existent@rev--ision--0--2'],
271
271
            allow_leftmost_as_ghost=True)
272
272
        rev_id = wt.commit('commit against a ghost first parent.')
273
273
        rev = wt.branch.repository.get_revision(rev_id)
274
 
        self.assertEqual(rev.parent_ids, ['non:existent@rev--ision--0--2'])
 
274
        self.assertEqual(rev.parent_ids, [b'non:existent@rev--ision--0--2'])
275
275
        # parent_sha1s is not populated now, WTF. rbc 20051003
276
276
        self.assertEqual(len(rev.parent_sha1s), 0)
277
277
 
282
282
            raise tests.TestNotApplicable(
283
283
                'format does not support ghosts')
284
284
        wt.set_parent_ids([
285
 
                'foo@azkhazan-123123-abcabc',
286
 
                'wibble@fofof--20050401--1928390812',
 
285
                b'foo@azkhazan-123123-abcabc',
 
286
                b'wibble@fofof--20050401--1928390812',
287
287
            ],
288
288
            allow_leftmost_as_ghost=True)
289
289
        rev_id = wt.commit("commit from ghost base with one merge")
290
290
        # the revision should have been committed with two parents
291
291
        rev = wt.branch.repository.get_revision(rev_id)
292
 
        self.assertEqual(['foo@azkhazan-123123-abcabc',
293
 
            'wibble@fofof--20050401--1928390812'],
 
292
        self.assertEqual([b'foo@azkhazan-123123-abcabc',
 
293
            b'wibble@fofof--20050401--1928390812'],
294
294
            rev.parent_ids)
295
295
 
296
296
    def test_commit_deleted_subtree_and_files_updates_workingtree(self):
374
374
            return
375
375
        subtree = self.make_branch_and_tree('subtree')
376
376
        subsubtree = self.make_branch_and_tree('subtree/subtree')
 
377
        subsub_revid = subsubtree.commit('subsubtree')
 
378
        subtree.commit('subtree')
377
379
        subtree.add(['subtree'])
378
380
        tree.add(['subtree'])
379
381
        # use allow_pointless=False to ensure that the deepest tree, which
382
384
        tree.lock_read()
383
385
        self.addCleanup(tree.unlock)
384
386
        # the deepest subtree has not changed, so no commit should take place.
385
 
        self.assertEqual('null:', subsubtree.last_revision())
 
387
        self.assertEqual(subsub_revid, subsubtree.last_revision())
386
388
        # the intermediate tree should have committed a pointer to the current
387
389
        # subtree revision.
388
390
        sub_basis = subtree.basis_tree()
443
445
            # inapplicable test.
444
446
            return
445
447
        subtree = self.make_branch_and_tree('subtree')
 
448
        subtree.commit('')
446
449
        tree.add(['subtree'])
447
450
        # record the reference.
448
451
        rev_id = tree.commit('added reference')
472
475
        self.build_tree(['a', 'b', 'c'])
473
476
        tree.add(['a', 'b', 'c'])
474
477
        tree.commit('first post')
475
 
        f = file('b', 'wt')
476
 
        f.write('new content')
477
 
        f.close()
 
478
        with open('b', 'wt') as f:
 
479
            f.write('new content')
478
480
        # set a progress bar that captures the calls so we can see what is
479
481
        # emitted
480
482
        factory = ProgressRecordingUIFactory()