[PREVIEW] line-endings support

Martin Pool mbp at canonical.com
Wed Apr 16 09:23:49 BST 2008


I was thinking about this the other day, and it seems that most of the
options being discussed have a lot of overlap with our existing
configuration system, and it would be nice to have only one rather than
two, all else being equal.

We already have a way to define settings that apply globally, per user,
per branch, per location (either recursively or not).  So, how about
adding a concept to the configuration system that you can ask it to look
up settings for a particular path, and they can match either the full path
or a glob.  As a straw man maybe in ~/.bazaar/bazaar.conf

  [glob:*.py]
  eol = native

I think eventually having these rules propagate to people who get
checkouts of the tree is important, indeed the main point of them is to
get consistent results when several people with different setups are
working on the same project.  So, whatever mechanism we use, it has to get
into the branch, and be carried around when you push, pull, etc.

If we specify these things as globs rather than as per-file properties we
avoid some scaling problems of having O(n) lists.  Even quite large trees
are likely to have modest numbers of different rules.

At the moment we have .bzr/branch/branch.conf, which applies to that
branch but I believe is never propagated.

One straightforward way to put this into the branch is to have it
controlled by a dot file in the tree, as Alexander has currently done.
Having it in there does have shortcomings but it really is pretty nice to
have conflicts and merges in the standard way.

If in the future we support filtered views this could be used to hide .bzr
control files when they're not needed.

There is the potential for security problems if arbitrary settings can be
controlled from the branch, so we might have to specify which ones are
safe to set there.  But it could be useful for more than just eol filters,
like setting a submission address.  I guess you can look at the git system
as having two configuration namespaces, one which can be set safely in the
tree, and another which is only per-user.

Another nice thing about doing this through configuration is that we can
stepwise have it at first just global (at least as a prototype) and then
make it more specific.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list