[PING][RFC][MERGE] alias to respect spaces in quoted arguments

Marius Kruger amanic at gmail.com
Mon Nov 27 07:12:52 GMT 2006


On 11/25/06, Wouter van Heyst <larstiq at larstiq.dyndns.org> wrote:
>
> On Fri, Nov 24, 2006 at 08:33:52AM +0200, Marius Kruger wrote:
> > ---------- Forwarded message ----------
> > From: Marius Kruger <amanic at gmail.com>
> > Date: Nov 14, 2006 5:58 AM
> > Subject: Re: [MERGE] alias to respect spaces in quoted arguments
> > To: Martin Pool <mbp at canonical.com>
> > Cc: Aaron Bentley <aaron.bentley at utoronto.ca>, "
> > bazaar-ng at lists.canonical.com" <bazaar-ng at lists.canonical.com>
> >
> >
> >
> > On 10/31/06, Martin Pool <mbp at canonical.com> wrote:
> > >
> > >It would actually be better to have a non-blackbox test that only ran
> > >get_alias directly; you'll need to make sure of how to set up the
> > >right configuration for the scope of this call which may be slightly
> > >complicated.  Since we identified the unicode problem we should test
> > >unicode handling too.
> > >
> >
> > Hi,
> > I was up for the challenge to write a non-blackbox test, but I ran into
> some
> > troubles:
> > It seems that the GlobalConfiguration gets read every time it is
> required.
> > Should it not be read once (lazily) and be kept in memory?
> > The reason this is problem for me is, that I can't modify the
> configuration
> > which will be loaded by the get_alias method (in commands.py), since it
> read
> > anew
> > every time its called, and I don't really want to modify the conf file
> for
> > this
> > non-blackbox test.
>
> I'm not sure what you mean here, have you looked at
> bzrlib/tests/test_config.py?


yes, but they cheat a bit, as they create a new config, give it some file
content
and then test if the the config returns the expected values:

my_config = config.GlobalConfig()
my_config._parser = my_config._get_parser(file=config_file)

My problem is, that the method in comands.py also creates
a new GlobalConfig() object, which will obviously not parse
the file content I set in my test.
My conclusion was thus that every time config.GlobalConfig()
is called, that the config is read anew. I would like us to
store a instance of the GlobalConfig config somewhere,
and just load it (lazily) and use the same instance everywhere,
so that we don't parse the file a million times.

I was thinking something like :
(in bzrlib/config.py)

_global_config=None

def get_global_config():
    if _global_config is not None:
        _global_config = config.GlobalConfig()
    return _global_config


> I also think it should be possible to set branch specific aliases,
> > where the branch specific one over-rides the global one.
> > I'll look into supporting this, If thats ok.
>
> This seems error-prone and confusing to me, how do you intend to use it?


Like you can set branch specific user-email (whoami),
I can imagine that you might want to do interesting aliases which
might only be appropriate for a specific  branch,
for example you might want a  particular branch to
output its diff differently, with some funny diff options or something..

Wouter van Heyst
>
> P.S. Do you have a branch available with your current work? It took some
> time puzzling things together going over archive mail from
>
> http://bundlebuggy.aaronbentley.com/request/%3C418c22640610200547y3f649c15w45714df1a8115f9@mail.gmail.com%3E
>
> In the end, gmane helped:
>
> http://thread.gmane.org/gmane.comp.version-control.bazaar-ng.general/18411/focus=19647
>
> Thanks for the puzzling, I tend to remove as much irrelevant quoted text
as possible,
but then you sometimes need the whole thread to piece it together..
I don't have  a proper branch, as my tinkering is minor and experimental,
and I haven't got anything suitable for committing yet.
Although I have a working hack which I am using, I'd like to do it properly
so
I'm first trying to write a proper test, which is proving tricky as I have
been warned...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20061127/454c7247/attachment.htm 


More information about the bazaar mailing list