~therp-nl/anybox.recipe.openerp/jbaudoux-relative_paths_resolve_conflict

« back to all changes in this revision

Viewing changes to anybox/recipe/openerp/vcs/tests/test_bzr.py

[MRG] Update with target branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
332
332
 
333
333
class BzrOfflineTestCase(BzrBaseTestCase):
334
334
 
335
 
    def make_local_branch(self, path, initial_rev):
 
335
    def make_local_branch(self, path, initial_rev, options=None):
336
336
        """Make a local branch of the source at initial_rev and forbid pulls.
337
337
        """
 
338
        if options is None:
 
339
            options = {}
338
340
        target_dir = os.path.join(self.dst_dir, path)
339
341
        # initial branching (non offline
340
342
        BzrBranch(target_dir, self.src_repo)(initial_rev)
341
343
 
342
344
        # crippled offline branch
343
 
        branch = BzrBranch(target_dir, self.src_repo, offline=True)
 
345
        branch = BzrBranch(target_dir, self.src_repo, offline=True, **options)
344
346
 
345
347
        def _pull():
346
 
            raise UpdateError("Should not pull !")
 
348
            self.fail("Should not pull !")
347
349
 
348
350
        branch._pull = _pull
349
351
        return branch
373
375
        revid = branch.get_revid('1')
374
376
        branch('revid:' + revid)
375
377
        self.assertRevision1(branch)
 
378
 
 
379
    def test_lightweight_checkout_noupdate(self):
 
380
        """[offline mode] lightweight checkouts shall not be updated."""
 
381
        branch = self.make_local_branch(
 
382
            "clone to update", '1',
 
383
            options={'bzr-init': 'lightweight-checkout'})
 
384
 
 
385
        def _update(*a, **kw):
 
386
            self.fail("Should not update !")
 
387
 
 
388
        branch._update = _update
 
389
 
 
390
        branch('last:1')
 
391
        self.assertRevision1(branch)
 
392
 
 
393
    def test_lightweight_checkout_noupdate_fixed_rev(self):
 
394
        """[offline mode] lightweight checkouts shall not be updated."""
 
395
        branch = self.make_local_branch(
 
396
            "clone to update", 'last:1',
 
397
            options={'bzr-init': 'lightweight-checkout'})
 
398
 
 
399
        def _update(*a, **kw):
 
400
            self.fail("Should not update !")
 
401
 
 
402
        branch._update = _update
 
403
 
 
404
        branch('1')
 
405
        self.assertRevision2(branch)