[MERGE] Rule-based preferences (EOL part 1 of 3)

Ian Clatworthy ian.clatworthy at internode.on.net
Wed May 28 08:23:39 BST 2008


Martin Pool wrote:
> On Fri, May 16, 2008 at 6:02 PM, Ian Clatworthy

> The documentation of globs and ini file syntax in the help topic is
> good but maybe either redundant or not in quite the right place
> because the same syntax is used in other places, and really the
> example may be enough to give people the idea.

I think it's ok to have the syntax information repeated in the rules
help topic. The section in the User Guide is brief but the rules help
topic forms part of the User Reference where detail is important IMO.
As things get formatted, "Rules" becomes a section in Concepts which
appears well before the ignore command does. We could decide to pull
the pattern language out into its own topic one day but having the
information right there while reading about both rules and ignore
is equally helpful. To summarise, I think this is ok as is.

> +# The cache of branch-specific rule searchers
> +_branch_searchers = {}
> +
> +
> +def iter_search_rules(branch, path_names, pref_names=None,
> +    _default_searcher=_per_user_searcher):
> +    """Find the preferences for filenames in a branch.
> 
> Having a cache in a global variable seems like a something we would
> generally try to avoid, because it's a bit uncontrolled and likely to
> either retain things you don't want, or not cache things you do want.
> In this case it seems like it should be held by the Branch?

iter_search_rules has been made a method on Tree now. Caching has been
provided for the commonly used Tree subclasses.

> I don't think putting a rules file in there is a good idea; in general
> everything in there should be determined solely by the branch format.
> Adding a new one would require a branch format bump, and also code to
> move them around, merge them, diff them, etc.  I think it would be
> much more appropriate to put it in the working tree as .bzrrules.
> (I'm happy to explain more about why this is so either in mail or
> elsewhere if you want but won't flog it for now.)

OK. The filenames are now:

* rules in BZR_HOME (defaults)
* .bzrrules in the root of the working tree

I believe that reflects the long discussion held in recent weeks about
the best place for these, given our current infrastructure. Robert still
has some more to say on this so I'd like to give that opportunity before
this gets merged into bzr.dev. I think it can be reviewed before then
though given you and I at least are comfortable with the implied trade-offs.

Ian C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rule-based-preferences-2.patch
Type: text/x-diff
Size: 45962 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080528/b4b413c3/attachment-0001.bin 


More information about the bazaar mailing list