~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_push.py

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
        self.assertEqual(tree.branch.last_revision(),
188
188
                         to_branch.last_revision())
189
189
 
 
190
    def test_push_overwrite_with_older_mainline_rev(self):
 
191
        """Pushing an older mainline revision with overwrite.
 
192
 
 
193
        This was <https://bugs.launchpad.net/bzr/+bug/386576>.
 
194
        """
 
195
        source = self.make_branch_and_tree('source')
 
196
        target = self.make_branch('target')
 
197
 
 
198
        source.commit('1st commit')
 
199
        source.commit('2nd commit', rev_id='rev-2')
 
200
        source.commit('3rd commit')
 
201
        source.branch.push(target)
 
202
        source.branch.push(target, stop_revision='rev-2', overwrite=True)
 
203
        self.assertEqual('rev-2', target.last_revision())
 
204
 
 
205
    def test_push_overwrite_of_non_tip_with_stop_revision(self):
 
206
        """Combining the stop_revision and overwrite options works.
 
207
 
 
208
        This was <https://bugs.launchpad.net/bzr/+bug/234229>.
 
209
        """
 
210
        source = self.make_branch_and_tree('source')
 
211
        target = self.make_branch('target')
 
212
 
 
213
        source.commit('1st commit')
 
214
        source.branch.push(target)
 
215
        source.commit('2nd commit', rev_id='rev-2')
 
216
        source.commit('3rd commit')
 
217
 
 
218
        source.branch.push(target, stop_revision='rev-2', overwrite=True)
 
219
        self.assertEqual('rev-2', target.last_revision())
 
220
 
190
221
    def test_push_repository_no_branch_doesnt_fetch_all_revs(self):
191
222
        # See https://bugs.launchpad.net/bzr/+bug/465517
192
223
        t = self.get_transport('target')
222
253
        # ancestry
223
254
        self.assertEqual([('A',), ('C',)], sorted(repo.revisions.keys()))
224
255
 
225
 
    def test_push_overwrite_of_non_tip_with_stop_revision(self):
226
 
        """Combining the stop_revision and overwrite options works.
227
 
 
228
 
        This was <https://bugs.launchpad.net/bzr/+bug/234229>.
229
 
        """
230
 
        source = self.make_branch_and_tree('source')
231
 
        target = self.make_branch('target')
232
 
 
233
 
        source.commit('1st commit')
234
 
        source.branch.push(target)
235
 
        source.commit('2nd commit', rev_id='rev-2')
236
 
        source.commit('3rd commit')
237
 
 
238
 
        source.branch.push(target, stop_revision='rev-2', overwrite=True)
239
 
        self.assertEqual('rev-2', target.last_revision())
240
 
 
241
256
    def test_push_with_default_stacking_does_not_create_broken_branch(self):
242
257
        """Pushing a new standalone branch works even when there's a default
243
258
        stacking policy at the destination.
246
261
        default for the branch), and will be stacked when the repo format
247
262
        allows (which means that the branch format isn't necessarly preserved).
248
263
        """
249
 
        if isinstance(self.branch_format, branch.BzrBranchFormat4):
 
264
        if self.bzrdir_format.fixed_components:
250
265
            raise tests.TestNotApplicable('Not a metadir format.')
251
266
        if isinstance(self.branch_format, branch.BranchReferenceFormat):
252
267
            # This test could in principle apply to BranchReferenceFormat, but
387
402
            raise tests.TestNotApplicable(
388
403
                'Does not apply when remote backing branch is also '
389
404
                'a smart branch')
390
 
        if isinstance(self.branch_format, branch.BzrBranchFormat4):
 
405
        if not self.branch_format.supports_leaving_lock():
391
406
            raise tests.TestNotApplicable(
392
 
                'Branch format 4 is not usable via HPSS.')
 
407
                'Branch format is not usable via HPSS.')
393
408
        super(EmptyPushSmartEffortTests, self).setUp()
394
409
        # Create a smart server that publishes whatever the backing VFS server
395
410
        # does.
446
461
    def test_lossy_push_raises_same_vcs(self):
447
462
        target = self.make_branch('target')
448
463
        source = self.make_branch('source')
449
 
        self.assertRaises(errors.LossyPushToSameVCS, source.lossy_push, target)
 
464
        self.assertRaises(errors.LossyPushToSameVCS, source.push, target, lossy=True)