/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_branch/test_pull.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 18:35:30 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7178.
  • Revision ID: jelmer@jelmer.uk-20181116183530-ue8yx60h5tinl2wy
Merge more-cleanups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
        self.assertEqual(tree_b.branch.last_revision(),
142
142
                         tree_a.branch.last_revision())
143
143
 
 
144
    def test_pull_overwrite_set(self):
 
145
        tree_a = self.make_branch_and_tree('tree_a')
 
146
        rev1 = tree_a.commit('message 1')
 
147
 
 
148
        tree_b = tree_a.controldir.sprout('tree_b').open_workingtree()
 
149
        rev2a = tree_a.commit('message 2a')
 
150
        rev2b = tree_b.commit('message 2b')
 
151
        self.assertRaises(errors.DivergedBranches, tree_a.pull, tree_b.branch)
 
152
        self.assertRaises(errors.DivergedBranches,
 
153
                          tree_a.branch.pull, tree_b.branch,
 
154
                          overwrite=set(), stop_revision=rev2b)
 
155
        # It should not have updated the branch tip, but it should have fetched
 
156
        # the revision if the repository supports "invisible" revisions
 
157
        self.assertEqual(rev2a, tree_a.branch.last_revision())
 
158
        if tree_a.branch.repository._format.supports_unreferenced_revisions:
 
159
            self.assertTrue(tree_a.branch.repository.has_revision(rev2b))
 
160
        tree_a.branch.pull(tree_b.branch, overwrite=set(['history']),
 
161
                           stop_revision=rev2b)
 
162
        self.assertEqual(rev2b, tree_a.branch.last_revision())
 
163
        self.assertEqual(tree_b.branch.last_revision(),
 
164
                         tree_a.branch.last_revision())
 
165
        tree_a.branch.pull(tree_b.branch, overwrite=set(['history', 'tags']),
 
166
                           stop_revision=rev2b)
 
167
 
 
168
    def test_pull_overwrite_set_tags(self):
 
169
        tree_a = self.make_branch_and_tree('tree_a')
 
170
        if not tree_a.branch.supports_tags():
 
171
            raise TestNotApplicable("branch does not support tags")
 
172
        rev1 = tree_a.commit('message 1')
 
173
        tree_a.branch.tags.set_tag('tag1', rev1)
 
174
 
 
175
        tree_b = tree_a.controldir.sprout('tree_b').open_workingtree()
 
176
        rev2a = tree_a.commit('message 2a')
 
177
        tree_b.branch.tags.set_tag('tag1', rev2a)
 
178
        rev2b = tree_b.commit('message 2b')
 
179
        tree_a.branch.get_config_stack().set('branch.fetch_tags', True)
 
180
        self.assertRaises(errors.DivergedBranches, tree_a.pull, tree_b.branch)
 
181
        self.assertRaises(errors.DivergedBranches,
 
182
                          tree_a.branch.pull, tree_b.branch,
 
183
                          overwrite=set(), stop_revision=rev2b)
 
184
        # It should not have updated the branch tip, but it should have fetched
 
185
        # the revision if the repository supports "invisible" revisions
 
186
        self.assertEqual(rev2a, tree_a.branch.last_revision())
 
187
        if tree_a.branch.repository._format.supports_unreferenced_revisions:
 
188
            self.assertTrue(tree_a.branch.repository.has_revision(rev2b))
 
189
        tree_a.branch.pull(tree_b.branch, overwrite=set(['history']),
 
190
                           stop_revision=rev2b)
 
191
        self.assertEqual(rev2b, tree_a.branch.last_revision())
 
192
        self.assertEqual(tree_b.branch.last_revision(),
 
193
                         tree_a.branch.last_revision())
 
194
        self.assertEqual(rev1, tree_a.branch.tags.lookup_tag('tag1'))
 
195
        tree_a.branch.pull(tree_b.branch, overwrite=set(['history', 'tags']),
 
196
                           stop_revision=rev2b)
 
197
        self.assertEqual(rev2a, tree_a.branch.tags.lookup_tag('tag1'))
 
198
 
144
199
    def test_pull_merges_and_fetches_tags(self):
145
200
        """Tags are updated by br.pull(source), and revisions named in those
146
201
        tags are fetched.