[PATCH] dispatch: provide an HG_ARGS environment variable to shell aliases

Didly Bom didlybom at gmail.com
Thu Jul 29 07:49:40 CDT 2010


On Thu, Jul 29, 2010 at 11:51 AM, Mads Kiilerich <mads at kiilerich.com> wrote:

> On 07/29/2010 05:52 AM, Steve Losh wrote:
>
>> # HG changeset patch
>> # User Steve Losh<steve at stevelosh.com>
>> # Date 1280375531 14400
>> # Node ID eb11d2fb96d16d5b8e55621260ea0e1d49d45aae
>> # Parent  84fb29f5e0d29bc95006947a62133032499e3fa3
>> dispatch: provide an HG_ARGS environment variable to shell aliases
>>
>> This patch changes the functionality of shell aliases to pass the extra
>> command
>> line arguments as an HG_ARGS environment variable, instead of simply
>> appending
>> them to the command.
>>
>> This allows for more flexible shell aliases:
>>
>>     [alias]
>>     echo = !echo $HG_ARGS
>>     count = !hg log -r "$HG_ARGS" --template='.' | wc -c | sed -e 's/ //g'
>>
>
> The official way to extend Mercurial is to use extensions. With this we
> take small steps towards introducing another (de facto platform specific)
> way to extend Mercurial. I assume the next steps will be positional and
> optional arguments - and proper handling of quoting/escaping. Do we want to
> go in that direction in core Mercurial?
>
> Perhaps we could make it simpler to write simple extensions in python
> instead? Perhaps few-liner extensions could be written directly in the
> config files?
>
> (Disclaimer: I don't like the new shell aliases for the reasons outlined
> above, so I'm biased aginst this extension of them ;-) )
>
> /Mads
>

On Thu, Jul 29, 2010 at 11:51 AM, Mads Kiilerich <mads at kiilerich.com> wrote:

> On 07/29/2010 05:52 AM, Steve Losh wrote:
>
>> # HG changeset patch
>> # User Steve Losh<steve at stevelosh.com>
>> # Date 1280375531 14400
>> # Node ID eb11d2fb96d16d5b8e55621260ea0e1d49d45aae
>> # Parent  84fb29f5e0d29bc95006947a62133032499e3fa3
>> dispatch: provide an HG_ARGS environment variable to shell aliases
>>
>> This patch changes the functionality of shell aliases to pass the extra
>> command
>> line arguments as an HG_ARGS environment variable, instead of simply
>> appending
>> them to the command.
>>
>> This allows for more flexible shell aliases:
>>
>>     [alias]
>>     echo = !echo $HG_ARGS
>>     count = !hg log -r "$HG_ARGS" --template='.' | wc -c | sed -e 's/ //g'
>>
>
> The official way to extend Mercurial is to use extensions. With this we
> take small steps towards introducing another (de facto platform specific)
> way to extend Mercurial. I assume the next steps will be positional and
> optional arguments - and proper handling of quoting/escaping. Do we want to
> go in that direction in core Mercurial?
>
> Perhaps we could make it simpler to write simple extensions in python
> instead? Perhaps few-liner extensions could be written directly in the
> config files?
>
> (Disclaimer: I don't like the new shell aliases for the reasons outlined
> above, so I'm biased aginst this extension of them ;-) )
>
> /Mads


I really like the idea of being able to directly write python functions or
extensions directly in the mercurial config file. It is something I missed
when I first started playing with hooks (it felt needlessly complicated to
have to declare the python functions in a separate file).

For example this would make it easier to share your configuration with other
people (sending/deploying a single file is simpler than deploying multiple
files).

Cheers,

Angel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100729/558ab992/attachment.htm>


More information about the Mercurial-devel mailing list