Rev 5419: Be more explicit about race conditions and LBYL being discouraged in file:///home/vila/src/bzr/bugs/323111-orphans/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Sep 16 10:20:53 BST 2010


At file:///home/vila/src/bzr/bugs/323111-orphans/

------------------------------------------------------------
revno: 5419
revision-id: v.ladeuil+lp at free.fr-20100916092053-hcbvuhy682c0evgd
parent: v.ladeuil+lp at free.fr-20100916091601-lxu7a33m3a3vb8hp
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: backup-names
timestamp: Thu 2010-09-16 11:20:53 +0200
message:
  Be more explicit about race conditions and LBYL being discouraged
-------------- next part --------------
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2010-09-09 13:02:55 +0000
+++ b/bzrlib/bzrdir.py	2010-09-16 09:20:53 +0000
@@ -524,7 +524,10 @@
         return self._available_backup_name(base)
 
     def _available_backup_name(self, base):
-        """Find a non-existing backup file name based on base."""
+        """Find a non-existing backup file name based on base.
+
+        See bzrlib.osutils.available_backup_name about race conditions.
+        """
         return osutils.available_backup_name(base, self.root_transport.has)
 
     def backup_bzrdir(self):

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2010-09-09 20:20:15 +0000
+++ b/bzrlib/osutils.py	2010-09-16 09:20:53 +0000
@@ -2361,10 +2361,12 @@
 
     This will *not* create anything, this only return a 'free' entry.  This
     should be used for checking names in a directory below a locked
-    tree/branch/repo to avoid race conditions.
+    tree/branch/repo to avoid race conditions. This is LBYL (Look Before You
+    Leap) and generally discouraged.
 
     :param base: The base name.
-    :param exists: A callable returning True if the passed path exists.
+
+    :param exists: A callable returning True if the path parameter exists.
     """
     counter = 1
     name = "%s.~%d~" % (base, counter)



More information about the bazaar-commits mailing list