[MERGE] Change CommitBuilder factory delegation to allow simple declaration.
Aaron Bentley
aaron.bentley at utoronto.ca
Sat Sep 15 03:08:24 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> On Fri, 2007-09-14 at 16:46 -0400, Aaron Bentley wrote:
>>> + result = self.__class__._commit_builder_class(self, parents, config,
>>> + timestamp, timezone, committer, revprops, revision_id)
>> I don't see why you're preventing overloading _commit_builder_class on
>> particular instances of Repository. I think self._commit_builder_class
>> is more suitable.
>>
>
> Our test suite only understands variation by format at the moment and
> every format has a dedicated class, so varying by instance does not
> assist us and could encourage the introduction of untested commit
> builders; I don't want to encourage that until/unless someone steps up
> with a use for it - and the changes (whatever they may be) to get it
> tested.
In Python, instance variables can override class variables, and as far
as I can tell, this is by design. If this is a real concern of yours,
you haven't gone nearly far enough to prevent it. For starters, commit
would need to do
self.builder = self.branch.__class__.get_commit_builder(self.branch ...
instead of
self.builder = self.branch.get_commit_builder(
Because methods are variables, too. Your code doesn't look safer to me
in any meaningful way. It looks like an arbitrary, ugly, violation of a
language feature.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFG6z6Y0F+nu1YWqI0RAskvAKCDwigpjKmGABYQ38rXrOj2ZVL0oACfV/tC
bOS2kbbwwvA/Pzp0MQTzMJ0=
=rGp/
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list