RFC new template keywords (wcmodified,wcmodifieddate) + sample impl.

Peter Bray peter.darren.bray at gmail.com
Wed Jun 1 00:44:23 UTC 2011


On  1/06/11 01:18 AM, Matt Mackall wrote:
>>>> - Templates support for determining if the working copy is modified.
>>>>
>>>>      In templates, I can't see a way to determine if the working copy
>>>>      has been modified. With "hg id -i" the plus (+) is not optional
>>>>      ("hg parents --template '{node|short}'" is the alternate). While
>>>>      in templates the plus or some indication that the working copy is
>>>>      modified does not seem to be available.
>>>
>>> Indeed, none of the commands that take templates actually pay any
>>> attention to the working directory in their display and I don't think
>>> it's ever occurred to anyone that they should. So this message is all a
>>> little weird to me.
>>
>> I suppose my point is that builds are done on working copies not
>> repositories, and changes to the working copy (probably) need to be
>> summarised in the build revision information. That information is
>> available in Mercurial, wouldn't it be nice to have a portable elegant
>> way to extract it for the build process, that is flexible enough to
>> handle whatever language / build system is in use.
>
> And my point is that this is just a really awkward fit. The commands
> that use templating are all about displaying information about revisions
> in history and not about telling about the status of the working
> directory. For instance, these new variables will make no sense at all
> with a normal log command. And the parents command has already been
> dropped from the short list of commands shown by 'hg' in favor of
> summary.
>

Ok, since there seem to be no steps to move forward these ideas, I'll 
return to the text extraction / output substitution approach. I think 
I'll use "hg id --id" as the plus is better than nothing. A future exit 
status based "is clean" feature I think would still be useful, but I'll 
leave that for your consideration.

As I've said I do like the flexibility, elegance and portability of the 
templating facility, but I'm not going to push it in directions that you 
did not intend it to go.

Many thanks for taking the time to comment on this request,

Peter

PS: And of course, _Many Many Thanks_ to yourself and community for 
developing and continuing to improve Mercurial!


More information about the Mercurial-devel mailing list