Rev 6068: Migrate locks.steal_dead to stack-based config. in file:///home/vila/src/bzr/experimental/migrate-config-options/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Aug 12 12:11:44 UTC 2011


At file:///home/vila/src/bzr/experimental/migrate-config-options/

------------------------------------------------------------
revno: 6068
revision-id: v.ladeuil+lp at free.fr-20110812121144-36z4ezknlgkmv9i6
parent: v.ladeuil+lp at free.fr-20110812072301-wxjabpfoamxg6u51
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: migrate-config-options
timestamp: Fri 2011-08-12 14:11:44 +0200
message:
  Migrate locks.steal_dead to stack-based config.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-08-10 14:30:17 +0000
+++ b/bzrlib/config.py	2011-08-12 12:11:44 +0000
@@ -2397,6 +2397,16 @@
     Option('language',
            help='Language to translate messages into.'))
 option_registry.register(
+    Option('locks.steal_dead', default=False, from_unicode=bool_from_store,
+           help='''\
+Steal locks that appears to be dead.
+
+If set to true, bzr will automatically break locks held by processes from
+the same machine and user that are no longer alive.  Otherwise, it will
+print a message and you can break the lock manually, if you are satisfied
+the object is no longer in use.
+'''))
+option_registry.register(
     Option('output_encoding',
            help= 'Unicode encoding for output'
            ' (terminal encoding if not specified).'))

=== modified file 'bzrlib/lockdir.py'
--- a/bzrlib/lockdir.py	2011-06-13 01:13:22 +0000
+++ b/bzrlib/lockdir.py	2011-08-12 12:11:44 +0000
@@ -295,9 +295,7 @@
         """
         if (other_holder is not None):
             if other_holder.is_lock_holder_known_dead():
-                if self.get_config().get_user_option_as_bool(
-                    'locks.steal_dead',
-                    default=False):
+                if self.get_config().get('locks.steal_dead'):
                     ui.ui_factory.show_user_warning(
                         'locks_steal_dead',
                         lock_url=urlutils.join(self.transport.base, self.path),
@@ -709,7 +707,8 @@
         """Get the configuration that governs this lockdir."""
         # XXX: This really should also use the locationconfig at least, but
         # that seems a bit hard to hook up at the moment. -- mbp 20110329
-        return config.GlobalConfig()
+        # FIXME: The above is still true ;) -- vila 20110811
+        return config.GlobalStack()
 
 
 class LockHeldInfo(object):



More information about the bazaar-commits mailing list