~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_commit.py

  • Committer: Martin Pool
  • Date: 2007-10-03 08:06:44 UTC
  • mto: This revision was merged to the branch mainline in revision 2901.
  • Revision ID: mbp@sourcefrog.net-20071003080644-oivy0gkg98sex0ed
Avoid internal error tracebacks on failure to lock on readonly transport (#129701).

Add new LockFailed, which doesn't imply that we failed to get it because of
contention.  Raise this if we fail to create the pending or lock directories
because of Transport errors.

UnlockableTransport is not an internal error.

ReadOnlyLockError has a message which didn't match its name or usage; it's now
deprecated and callers are updated to use LockFailed which is more appropriate.

Add zero_ninetytwo deprecation symbol.

Unify assertMatchesRe with TestCase.assertContainsRe.

When the constructor is deprecated, just say that the class is deprecated, not
the __init__ method - this works better with applyDeprecated in tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
538
538
        out, err = self.run_bzr('commit test -m "partial commit"')
539
539
        self.assertEquals('', out)
540
540
        self.assertContainsRe(err, r'modified test\nCommitted revision 2.')
 
541
 
 
542
    def test_commit_readonly_checkout(self):
 
543
        # https://bugs.edge.launchpad.net/bzr/+bug/129701
 
544
        # "UnlockableTransport error trying to commit in checkout of readonly
 
545
        # branch"
 
546
        self.make_branch('master')
 
547
        master = BzrDir.open_from_transport(
 
548
            self.get_readonly_transport('master')).open_branch()
 
549
        master.create_checkout('checkout')
 
550
        out, err = self.run_bzr(['commit', '--unchanged', '-mfoo', 'checkout'],
 
551
            retcode=3)
 
552
        self.assertContainsRe(err,
 
553
            r'^bzr: ERROR: Cannot lock.*readonly transport\n$')