/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 bzrlib/tests/test_lockdir.py

  • Committer: Martin Pool
  • Date: 2011-06-10 07:01:07 UTC
  • mto: This revision was merged to the branch mainline in revision 5970.
  • Revision ID: mbp@canonical.com-20110610070107-d8x1rq9b6o32b1ub
Support auto-stealing dead locks, but turn it off by default.

Rename the option to 'locks.steal_dead' for consistent grouping.

Factor out code for dealing with contention.

Show diffs side-by-side

added added

removed removed

Lines of Context:
708
708
 
709
709
    :see: https://bugs.launchpad.net/bzr/+bug/220464
710
710
    """
 
711
 
711
712
    def test_auto_break_stale_lock(self):
712
713
        """Locks safely known to be stale are just cleaned up.
713
714
 
714
715
        This generates a warning but no other user interaction.
715
716
        """
 
717
        # This is off by default at present; see the discussion in the bug.
 
718
        # If you change the default, don't forget to update the docs.
 
719
        config.GlobalConfig().set_user_option('locks.steal_dead', True)
716
720
        # Create a lock pretending to come from a different nonexistent
717
721
        # process on the same machine.
718
722
        l1 = LockDir(self.get_transport(), 'a',
732
736
        token_1 = l1.attempt_lock()
733
737
        self.addCleanup(l1.unlock)
734
738
        l2 = LockDir(self.get_transport(), 'a')
735
 
        # This fails now, because dead lock breaking is turned off.
736
 
        config.GlobalConfig().set_user_option('steal_dead_locks', False)
 
739
        # This fails now, because dead lock breaking is off by default.
737
740
        self.assertRaises(LockContention,
738
741
            l2.attempt_lock)
739
742
        # and it's in fact not broken