You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fast question:
Could we have access to the current path of the objects to be merged inside the merge function of the store's content.
Long description:
I am currently using Irmin for a project and want to handle merges properly.
From what I have understood, I need to redefine the merge function inside the module I use as content for the store functor:
moduleContent_string=structincludeIrmin.Contents.Stringlet merge =let dt =Irmin.Type.(optionstring) inlet equal =Irmin.Type.(unstage (equal dt)) inlet default =Irmin.Merge.default dt inletf~oldxy=(* do my own stuff instead of the default idempotent behavior *)if equal x y thenIrmin.Merge.ok x elseIrmin.Merge.f default ~old x y
inIrmin.Merge.v dt f
end
In this bit of code, I would have to replace the content of f copy-pasted from Merge.idempotent with my own custom function.
However, it appeared that I have not access to the current path of the objects that I want to merge.
Indeed, I do not always have the same objects inside the different trees of my store and I will want to have a specific merge for each type of them.
Therefore would it be possible for the signature of the merge function to be something like: val merge: ~old:t -> ~key:Key.t -> t -> t -> t
Instead of val merge: ~old:t -> t -> t -> t
It would allow a more specific and refined merge behavior
The text was updated successfully, but these errors were encountered:
That's a great idea and something I wanted to do for a very long time but that API is hard to define properly. as Key.t is (currently) generic and opaque. I am hoping that now that we have introduced schemas, this could be somehow be passed to the user-defined merge function.
Fast question:
Could we have access to the current path of the objects to be merged inside the
merge
function of the store's content.Long description:
I am currently using Irmin for a project and want to handle merges properly.
From what I have understood, I need to redefine the
merge
function inside the module I use as content for the store functor:In this bit of code, I would have to replace the content of
f
copy-pasted fromMerge.idempotent
with my own custom function.However, it appeared that I have not access to the current path of the objects that I want to merge.
Indeed, I do not always have the same objects inside the different trees of my store and I will want to have a specific merge for each type of them.
Therefore would it be possible for the signature of the merge function to be something like:
val merge: ~old:t -> ~key:Key.t -> t -> t -> t
Instead of
val merge: ~old:t -> t -> t -> t
It would allow a more specific and refined merge behavior
The text was updated successfully, but these errors were encountered: