Thanks for clarifying.
To summarize (if I got it right) the revision parameter specifies the
base revision for a three way merge of the transient changes into the
current head revision.
So this can actually be used to implement 1) (see
http://markmail.org/message/e2ipk54t2bhrepab) right?
Michael
On 26.1.12 14:31, Stefan Guggisberg wrote:
On Wed, Jan 25, 2012 at 5:40 PM, Michael Dürig<[email protected]> wrote:
Hi,
Microkernel.commit() has a revisionId parameter. Could someone (Stefan?)
clarify the semantics of this parameter? The Javadoc only says "revision the
changes are based on". But it fails to explain the actual effect of that
parameter.
the revisionId parameter of the commit method provides the
context of the changes specified by the jsonDiff parameter.
while it's true that all changes are always applied on the
current HEAD revision, the 'baseRevision' of a commit allows
for smarter 3-way merges/conflict resolutions.
an example:
assume a node /foo exists in rev0 of the tree and
sessions s1 and s2 are both based on rev0.
now s1 moves /foo to /bar while s2 sets a property on /foo :
// s1
mk.commit("/", ">\"foo\": \"bar\"", rev0, "");
// s2
mk.commit("/", "^\"foo/prop\" : \"blah\"", rev0, "");
knowing the context of the commit (-> rev0) allows the
2nd commit to apply the property modification on /bar
instead of throwing a "path not found: /foo" exception.
please note that this specific use case is currently not
yet implemented in MicroKernelImpl.
cheers
stefan
Michael