[RFC] A configurable scheme+location for custom rules

Ian Clatworthy ian.clatworthy at internode.on.net
Tue Jan 20 11:29:31 GMT 2009


As discussed in response to my tree-specific rules patch,
Bazaar currently supports rules configured per user in
BZR_HOME/rules. That's great in that it lets users
define some global defaults they like but it isn't
going to be enough. At a minimum, different projects
will have different rules and share them across their
development team.

Thinking more broadly, it would be nice if we supported
rules specific to:

1. a tree
2. a branch
3. a project
4. a user

More importantly, it must be easy to *share* rules across
any of the above. In some cases, it might make sense to share
rules across semi-related projects, e.g. a bunch of bzr
plugins.

There are other desires too. Some users feel rules ought
to be strictly treated as configuration while other's
what to keep them versioned. Tools like bzr-svn and bzr-git
may wish to dynamically map rules to the matching concept
in the foreign system, making the .bzrrules approach
an interfacing burden.

Speaking to poolie about this topic today, I'd like to
propose a more flexible solution than my tree-specific
rules offered. Here it is.

We support a new configuration setting called rules_location.
The value of this setting has the format:

  [scheme::]path_or_url

Initially, the only supported scheme is "bzr", i.e. the
rules are to be parsed in Bazaar's (ini-file) format.
The path is relative to the working tree root but a URL
can be given if you want.

The setting can be defined in branch.conf, locations.conf
or bazaar.conf with earlier locations taking priority.
This implies that there are only two levels of rules for
a given tree/branch: the custom one and the per user one.
That greatly reduces the complexity vs combining rules
across potentially 3 or 4 levels.

Here are some examples of how I expect different user
needs being satisfied by this solution:

* Fred has the common setup of a bunch of branches inside
  a shared repo for a project. He adds the following
  setting to location.conf:

    rules_location = ../projectX-rules.conf

* Mary's co-located development team store their rules
  in a central location, e.g. on a fast http server.
  The history of the rules are tracked in a separate
  bzr branch. Developers are required to configure
  rules location is either bazaar.conf or locations.conf
  with a value something like:

    rules_location = http://myserver/foo-rules.conf

* Bill wants keywords expanded in a selected tree/branch.
  He adds a setting to branch.conf. (If and when we support
  a tree.conf file, he can use that.)

* Chloe wants to share rules across a bunch of small
  projects managed by plain bzr branches. She adds a
  setting like

    rules_location = ../plugins-rules.conf

  to each branch.conf.

* Alex really wants to store his rules in his working tree.
  He adds "rules_location = .bzrrules" to branch.conf and
  adds ".bzrrules" to his ".bzrignore" file.

I'm convinced I can't make everyone happy with any solution
I propose so I'm aiming for "no-one violently objects" :-)

Thoughts?

Ian C.



More information about the bazaar mailing list