jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1171547 - in /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk: MicroKernelImpl.java store/CommitBuilder.java
Date Fri, 16 Sep 2011 13:33:30 GMT
Author: stefan
Date: Fri Sep 16 13:33:30 2011
New Revision: 1171547

URL: http://svn.apache.org/viewvc?rev=1171547&view=rev
Log:
avoid bumping head revision for 'empty' commits

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java?rev=1171547&r1=1171546&r2=1171547&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
Fri Sep 16 13:33:30 2011
@@ -407,6 +407,10 @@ public class MicroKernelImpl implements 
                 }
             }
             String newHead = cb.doCommit();
+            if (newHead.equals(revisionId)) {
+                // 'empty' commit
+                return newHead;
+            }
             gate.commit(newHead);
             return newHead;
         } catch (Exception e) {

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java?rev=1171547&r1=1171546&r2=1171547&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java
Fri Sep 16 13:33:30 2011
@@ -198,6 +198,11 @@ public class CommitBuilder {
                 baseRevId = currentHead;
             }
 
+            if (rep.getCommit(currentHead).getRootNodeId().equals(rootNodeId)) {
+                // the commit didn't cause any changes,
+                // no need to create new commit object/update head revision
+                return currentHead;
+            }
             MutableCommit newCommit = new MutableCommit();
             newCommit.setParentId(baseRevId);
             newCommit.setCommitTS(System.currentTimeMillis());



Mime
View raw message