Re: [RFC PATCH 0/4] interpret-trailers: introduce "move" action
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Oct 6, 2017, 13:19 UTC
- Message-ID
- <CAP8UFD2_ZC4J4eRxq04TJ6-xyK5oTqHM2qd+5HfPV7jcoShvqw@mail.gmail.com>
- In-Reply-To
- <fe023f38-01cc-2257-bbfe-3f4310193b41@redhat.com>
On Fri, Oct 6, 2017 at 2:39 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
Show 10 quoted lines
> On 06/10/2017 14:33, Christian Couder wrote: >> Ok. I think you might want something called for example >> "replaceIfIdenticalClose" where "IdenticalClose" means: "there is a >> trailer with the same (<token>, <value>) pair above or below the line >> where the replaced trailer will be put when ignoring trailers with a >> different <token>". > > So basically "moveIfClosest" (move if last for where=end, move if first > for where=begin; for where=after and where=before it would just end up > doing nothing)?
First yeah these would not make sense anyway if where=after or where=before.
Now it would be strange to have "moveIfClosest" without having "move" first and I don't see how "move" would be different from the existing "replace". Or maybe "move" means "replaceIfIdentical", in this case I think it would help users to just call it "replaceIfIdentical".
Also there is "addIfDifferentNeighbor" so we already have "Neighbor" which means "just above or below". Then if we use "Closest" I think it will be harder to distinguish it from "Neighbor" than if we use "Close".
That's why I think "replaceIfIdenticalClose" is better. It could enable us to eventually use a regexp like "(add|replace)(If(Different|Identical)(Close|Neighbor)+)+" to parse the add* and replace* options.