You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Michael Dürig <mi...@gmail.com> on 2012/01/25 17:40:11 UTC

[jr3 Microkernel] semantics of revisionId in commit method

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.

Michael

Re: [jr3 Microkernel] semantics of revisionId in commit method

Posted by Stefan Guggisberg <st...@gmail.com>.
On Thu, Jan 26, 2012 at 4:56 PM, Michael Dürig <md...@apache.org> wrote:
>
> 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.

correct

>
> So this can actually be used to implement 1) (see
> http://markmail.org/message/e2ipk54t2bhrepab) right?

yes

cheers
stefan

>
> Michael
>
>
> On 26.1.12 14:31, Stefan Guggisberg wrote:
>>
>> On Wed, Jan 25, 2012 at 5:40 PM, Michael Dürig<mi...@gmail.com>  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

Re: [jr3 Microkernel] semantics of revisionId in commit method

Posted by Michael Dürig <md...@apache.org>.
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<mi...@gmail.com>  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

Re: [jr3 Microkernel] semantics of revisionId in commit method

Posted by Stefan Guggisberg <st...@gmail.com>.
On Wed, Jan 25, 2012 at 5:40 PM, Michael Dürig <mi...@gmail.com> 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