/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_push.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:
208
208
        tree_a = make_shared_tree('a')
209
209
        self.build_tree(['repo/a/file'])
210
210
        tree_a.add('file')
211
 
        tree_a.commit('commit a-1', rev_id=b'a-1')
 
211
        tree_a.commit('commit a-1', rev_id='a-1')
212
212
        f = open('repo/a/file', 'ab')
213
213
        f.write('more stuff\n')
214
214
        f.close()
215
 
        tree_a.commit('commit a-2', rev_id=b'a-2')
 
215
        tree_a.commit('commit a-2', rev_id='a-2')
216
216
 
217
217
        tree_b = make_shared_tree('b')
218
218
        self.build_tree(['repo/b/file'])
219
219
        tree_b.add('file')
220
 
        tree_b.commit('commit b-1', rev_id=b'b-1')
 
220
        tree_b.commit('commit b-1', rev_id='b-1')
221
221
 
222
222
        self.assertTrue(shared_repo.has_revision('a-1'))
223
223
        self.assertTrue(shared_repo.has_revision('a-2'))
256
256
        source.start_series()
257
257
        source.build_snapshot(None, [
258
258
            ('add', ('', 'root-id', 'directory', None))],
259
 
            revision_id=b'A')
260
 
        source.build_snapshot(['A'], [], revision_id=b'B')
261
 
        source.build_snapshot(['A'], [], revision_id=b'C')
 
259
            revision_id='A')
 
260
        source.build_snapshot(['A'], [], revision_id='B')
 
261
        source.build_snapshot(['A'], [], revision_id='C')
262
262
        source.finish_series()
263
263
        self.run_bzr('push target -d source')
264
264
        self.addCleanup(target_repo.lock_read().unlock)
363
363
    def create_simple_tree(self):
364
364
        tree = self.make_branch_and_tree('tree')
365
365
        self.build_tree(['tree/a'])
366
 
        tree.add(['a'], [b'a-id'])
367
 
        tree.commit('one', rev_id=b'r1')
 
366
        tree.add(['a'], ['a-id'])
 
367
        tree.commit('one', rev_id='r1')
368
368
        return tree
369
369
 
370
370
    def test_push_create_prefix(self):
578
578
        builder.build_snapshot(None, [
579
579
            ('add', ('', 'root-id', 'directory', '')),
580
580
            ('add', ('filename', 'f-id', 'file', 'content\n'))],
581
 
            revision_id=b'rev-1')
582
 
        builder.build_snapshot([b'rev-1'], [], revision_id=b'rev-2')
583
 
        builder.build_snapshot([b'rev-2'],
584
 
            [('modify', ('filename', b'new-content\n'))],
585
 
            revision_id=b'rev-3')
 
581
            revision_id='rev-1')
 
582
        builder.build_snapshot(['rev-1'], [], revision_id='rev-2')
 
583
        builder.build_snapshot(['rev-2'],
 
584
            [('modify', ('f-id', 'new-content\n'))],
 
585
            revision_id='rev-3')
586
586
        builder.finish_series()
587
587
        branch = builder.get_branch()
588
588
        # Push rev-1 to "trunk", so that we can stack on it.
727
727
 
728
728
    def make_local_branch_and_tree(self):
729
729
        self.tree = self.make_branch_and_tree('local')
730
 
        self.build_tree_contents([('local/file', b'initial')])
 
730
        self.build_tree_contents([('local/file', 'initial')])
731
731
        self.tree.add('file')
732
 
        self.tree.commit('adding file', rev_id=b'added')
733
 
        self.build_tree_contents([('local/file', b'modified')])
734
 
        self.tree.commit('modify file', rev_id=b'modified')
 
732
        self.tree.commit('adding file', rev_id='added')
 
733
        self.build_tree_contents([('local/file', 'modified')])
 
734
        self.tree.commit('modify file', rev_id='modified')
735
735
 
736
736
    def set_config_push_strict(self, value):
737
737
        br = branch.Branch.open('local')
823
823
    def _uncommitted_changes(self):
824
824
        self.make_local_branch_and_tree()
825
825
        # Make a change without committing it
826
 
        self.build_tree_contents([('local/file', b'in progress')])
 
826
        self.build_tree_contents([('local/file', 'in progress')])
827
827
 
828
828
    def _pending_merges(self):
829
829
        self.make_local_branch_and_tree()
830
830
        # Create 'other' branch containing a new file
831
831
        other_bzrdir = self.tree.controldir.sprout('other')
832
832
        other_tree = other_bzrdir.open_workingtree()
833
 
        self.build_tree_contents([('other/other-file', b'other')])
 
833
        self.build_tree_contents([('other/other-file', 'other')])
834
834
        other_tree.add('other-file')
835
 
        other_tree.commit('other commit', rev_id=b'other')
 
835
        other_tree.commit('other commit', rev_id='other')
836
836
        # Merge and revert, leaving a pending merge
837
837
        self.tree.merge_from_branch(other_tree.branch)
838
838
        self.tree.revert(filenames=['other-file'], backups=False)
841
841
        self.make_local_branch_and_tree()
842
842
        self.run_bzr(['checkout', '--lightweight', 'local', 'checkout'])
843
843
        # Make a change and commit it
844
 
        self.build_tree_contents([('local/file', b'modified in local')])
845
 
        self.tree.commit('modify file', rev_id=b'modified-in-local')
 
844
        self.build_tree_contents([('local/file', 'modified in local')])
 
845
        self.tree.commit('modify file', rev_id='modified-in-local')
846
846
        # Exercise commands from the checkout directory
847
847
        self._default_wd = 'checkout'
848
848
        self._default_errors = ["Working tree is out of date, please run"
889
889
        builder = self.make_branch_builder(
890
890
            relpath, format=test_foreign.DummyForeignVcsDirFormat())
891
891
        builder.build_snapshot(None,
892
 
            [('add', ('', b'TREE_ROOT', 'directory', None)),
893
 
             ('add', ('foo', b'fooid', 'file', 'bar'))],
894
 
            revision_id=b'revid')
 
892
            [('add', ('', 'TREE_ROOT', 'directory', None)),
 
893
             ('add', ('foo', 'fooid', 'file', 'bar'))],
 
894
            revision_id='revid')
895
895
        return builder
896
896
 
897
897
    def test_no_roundtripping(self):