RFC: setting policy for configuration data
James Henstridge
james at jamesh.id.au
Fri Oct 13 03:45:56 BST 2006
While discussing my cascading configuration patch, one of the issues
brought up was the different ways a configuration item could be scoped
in ~/.bazaar/locations.conf. The three policies highlighted were:
1. apply to the path identified by the section name plus all subdirectories
2. apply to only the path identified by the section name
3. apply to the path identified by the section name plus all
subdirectories, but append trailing path components to the resulting
value.
In addition to these three, there are two more policies for branch
configuration:
4. global (~/.bazaar/bazaar.conf)
5. inside the branch (.bzr/branch.conf)
It was decided that it would be best to handle policy when setting
configuration values, since this would give the user the option to
customise the policy for a key in their ~/.bazaar/locations.conf file
after the fact.
There is already some policy setting support in the third argument to
BranchConfig.set_user_option(), that chooses between policy (1) and
(5). An easy extension to the current API would be to change the
argument to an enumeration. A similar argument could be added to
LocationConfig.set_user_option() to pick between the first three
policies.
One open question is how to store the policy setting in
~/.bazaar/locations.conf. Aaron had two suggestions. The first was
to have an extra key giving the policy for a related key. This might
look something like:
[/some/repo]
push_location = sftp://server/repo
push_location_policy = appendpath
[/some/repo/branch]
push_location = sftp://server2/branch
push_location_policy = norecurse
The second suggestion was to use a key to specify which other keys
used which policies. Maybe something like this:
[/some/repo]
push_location = sftp://server/repo
appendpath = ["push_location"]
[/some/repo/branch]
push_location = sftp://server2/branch
norecurse = ["push_location"]
I had a third idea which was to put the policy in the section name.
Something like this:
[appendpath /some/repo]
push_location = sftp://server/repo
[only /some/repo/branch]
push_location = sftp://server2/branch
After playing around with my policy-in-section name idea a bit, I
think one of Aaron's suggestions is probably a better way to go, since
we don't need to worry about precedence order of multiple sections for
a single directory.
So which of the above syntaxes looks best?
James.
More information about the bazaar
mailing list