jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r801210 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java
Date Wed, 05 Aug 2009 13:10:28 GMT
Author: tripod
Date: Wed Aug  5 13:10:28 2009
New Revision: 801210

URL: http://svn.apache.org/viewvc?rev=801210&view=rev
Log:
Explode merge code to be more verbose and aligned with description in spec.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java?rev=801210&r1=801209&r2=801210&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java
Wed Aug  5 13:10:28 2009
@@ -317,9 +317,42 @@
         if (!srcNode.getEffectiveNodeType().includesNodeType(NameConstants.MIX_VERSIONABLE))
{
             return null;
         }
-        // test versions
+        // test versions. the following code could be simplified but is
+        // intentionally expanded for follow the spec.
         InternalVersion v = getBaseVersion(state);
         InternalVersion vp = getBaseVersion(srcNode);
+        if (!isCheckedOut(state)) {
+            // If N is currently checked-in then:
+            if (vp.isMoreRecent(v)) {
+                // - If V' is an eventual successor of V, then the merge result for N is
update.
+                return srcNode;
+            } else if (v.equals(vp) || v.isMoreRecent(vp)) {
+                // - If V' is an eventual predecessor of V or if V and V' are identical (i.e.,
are
+                // actually the same version), then the merge result for N is leave.
+                return null;
+            } else {
+                // - If V is neither an eventual successor of, eventual predecessor of, nor
+                // identical with V', then the merge result for N is failed. This is the
case
+                // where N and N' represent divergent branches of the version graph.
+
+                // failed is covered below
+            }
+        } else {
+            // If N is currently checked-out then:
+            if (v.equals(vp) || v.isMoreRecent(vp)) {
+                // - If V' is an eventual predecessor of V or if V and V' are identical (i.e.,
are
+                //   actually the same version), then the merge result for
+                //   N is leave.
+                return null;
+            } else {
+                // - If any other relationship holds between V and V', then the merge result
+                //   for N is fail.
+
+                // failed is covered below
+            }
+        }
+
+
         if (vp.isMoreRecent(v) && !isCheckedOut(state)) {
             // I f V' is a successor (to any degree) of V, then the merge result for
             // N is update. This case can be thought of as the case where N' is



Mime
View raw message