[MERGE] Add Branch support to CommitBuilder

Martin Pool mbp at canonical.com
Fri Jan 19 01:54:30 GMT 2007


On 17 Jan 2007, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
> > -        return _CommitBuilder(self, parents, config, timestamp, timezone,
> > -                              committer, revprops, revision_id)
> > +        self._check_revisionid_acceptable(revision_id, self.get_commit_builder)
> > +        klass = self._format.get_commit_builder()
> > +        return klass(self, parents, config, timestamp, timezone, committer, 
> > +                     revprops, revision_id, branch, local_branch)
> 
> I don't see why the RepositoryFormat should determine the CommitBuilder
> when the Repository controls most of the mechanism actually used for
> committing.  For example, the serializer is selected by the Repository,
> not the RepositoryFormat, yet miss-matched serializers and
> CommitBuilders will often cause commit to fail.
> 
> If you want to avoid redefining _get_commit_builder, you can just define
> RepositoryFormat._commit_builder_class (as either a method or a class
> variable) and construct that in Repository.get_commit_builder()

(Tangentially) this is the sort of issue that makes me somewhat
uncomfortable with the split between RepositoryFormat and Repository.
In many ways an instance of a RepositoryFormat just corresponds to a
class of Repository.  Formats have (generally) no state and are
constructed whenever they're needed.

The point of a RepositoryFormat is to let you identify, initialize, and
open repositories.  These could be perfectly happy as Repository class
methods.

I think the only snag here is that instances of BzrDirFormat can have
state, being a representation of the formats of the other objects that
are held inside them.

-- 
Martin



More information about the bazaar mailing list