This is an archive of the discontinued Mercurial Phabricator instance.

rebase: use fm.formatlist() and fm.formatdict() to support user template
ClosedPublic

Authored by pulkit on Nov 2 2017, 4:23 PM.

Details

Summary

Thanks to Yuya for suggesting this in D1173.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Nov 2 2017, 4:23 PM
yuja requested changes to this revision.Nov 4 2017, 3:50 AM
yuja added a subscriber: yuja.

Can you add a test that should be fixed by this patch?
Perhaps that will show we'll probably want to set the name of dict item pair
other than the default 'key'/'value'.

hgext/rebase.py
1568

The name argument is for each item, not for the list. Perhaps,
it should be name='node' (or name ='succ').

This revision now requires changes to proceed.Nov 4 2017, 3:50 AM
In D1293#21761, @yuja wrote:

Can you add a test that should be fixed by this patch?
Perhaps that will show we'll probably want to set the name of dict item pair
other than the default 'key'/'value'.

Sorry but I am unable to understand the test part. Can you point me to an example?

yuja added a comment.Nov 9 2017, 7:12 AM

Something like this:

-T '{nodechanges % ": {value % ...}"}'

pulkit updated this revision to Diff 3670.Nov 20 2017, 2:04 PM
pulkit updated this revision to Diff 3705.Nov 20 2017, 8:04 PM
In D1293#22323, @yuja wrote:

Something like this:
-T '{nodechanges % ": {value % ...}"}'

I have added a test. I am not sure whether that was what you wanted.

(Fun fact: I was trying various permutations of {nodechanges % ":{value % ...}"} and gave up last night. When I quoted your comment to say I am unable to come up with a case, I saw you had {key} in your comment too which was invisible. )

yuja added a comment.Nov 21 2017, 7:38 AM

I am not sure whether that was what you wanted.

It's getting closer, thanks. What I meant is {key} and {value} wouldn't be good
keyword names because the they are actually an old node and a list of new nodes
respectively.

I think a template should be expressed something like this:

`{oldnode}: {newnodes % '{node} '}`
pulkit updated this revision to Diff 3725.Nov 21 2017, 11:54 AM
yuja accepted this revision.Nov 22 2017, 8:18 AM
This revision is now accepted and ready to land.Nov 22 2017, 8:18 AM
yuja added a comment.Nov 22 2017, 8:18 AM

Queued the series, many thanks.

This revision was automatically updated to reflect the committed changes.