[MERGE] Change FileNames allocation strategy

Martin Pool mbp at canonical.com
Tue Aug 7 05:29:37 BST 2007


Martin Pool has voted resubmit.
Status is now: Resubmit
Comment:
+    def allocate(self, name=None):
+        """Allocate name in the names collection.
+
+        :param name: The name to allocate.
+        :raises: bzrlib.errors.DuplicateKey if the name is already 
allocated.
+        """
+        if name is not None:
+            if len(self._names) >= self._cap:
+                raise errors.BzrError('too many files')
+            if name in self._names:
+                raise errors.DuplicateKey(name)
+            self._names.add(name)
+            return name

So this silently does nothing if no name parameter is passed?  That 
seems a bit cruel.

How about if you instead leave allocate() with its current meaning (for 
callers who don't care about names), and add a new add(name) with a 
mandatory parameter.  Or if nobody calls allocate aside from your own 
code, just delete it and add add().

For details, see: 
http://bundlebuggy.aaronbentley.com/request/%3C1186444328.23776.74.camel%40localhost.localdomain%3E



More information about the bazaar mailing list