Index: xwiki-platform-core/src/test/java/com/xpn/xwiki/doc/XWikiDocumentTest.java =================================================================== --- xwiki-platform-core/src/test/java/com/xpn/xwiki/doc/XWikiDocumentTest.java (revision 4018) +++ xwiki-platform-core/src/test/java/com/xpn/xwiki/doc/XWikiDocumentTest.java (working copy) @@ -79,4 +79,24 @@ assertEquals("Title", this.document.getDisplayTitle(this.context)); } + + public void testMinorMajorVersions() { + // there is no version in doc yet, so 1.1 + assertEquals("1.1", this.document.getVersion()); + + this.document.setMinorEdit(false); + this.document.incrementVersion(); + // no version => incrementVersion sets 1.1 + assertEquals("1.1", this.document.getVersion()); + + this.document.setMinorEdit(false); + this.document.incrementVersion(); + // increment major version + assertEquals("2.1", this.document.getVersion()); + + this.document.setMinorEdit(true); + this.document.incrementVersion(); + // increment minor version + assertEquals("2.2", this.document.getVersion()); + } } Index: xwiki-platform-core/src/test/java/com/xpn/xwiki/doc/XWikiDocumentArchiveTest.java =================================================================== --- xwiki-platform-core/src/test/java/com/xpn/xwiki/doc/XWikiDocumentArchiveTest.java (revision 4018) +++ xwiki-platform-core/src/test/java/com/xpn/xwiki/doc/XWikiDocumentArchiveTest.java (working copy) @@ -19,8 +19,17 @@ */ package com.xpn.xwiki.doc; +import java.util.Arrays; +import java.util.Date; + import junit.framework.TestCase; +import org.apache.tools.ant.filters.StringInputStream; +import org.suigeneris.jrcs.rcs.Archive; + +import com.xpn.xwiki.XWikiContext; +import com.xpn.xwiki.XWikiException; + /** * Unit tests for {@link com.xpn.xwiki.doc.XWikiDocumentArchive}. * @@ -153,12 +162,69 @@ // Set a username with a space System.setProperty("user.name", "Vincent Massol"); + + XWikiContext context = new XWikiContext(); + archive.updateArchive("XWiki.XWikiGuest", new Date(), "comment", false, originalText, context); - archive.updateArchive("Main.WebHome", originalText); - // Try to construct again the archive from the last modification. This will happen when // XWiki loads a document from the database for example. We verify here that a username // with a space works. - new XWikiDocumentArchive(123456789L).setArchive(archive.getArchive()); + new XWikiDocumentArchive(123456789L).setArchive(archive.getArchive(context)); } + + public void testUpdateLoad() throws XWikiException { + XWikiDocument doc = new XWikiDocument("Test", "Test"); + doc.setContent("content 1.1"); + + XWikiContext context = new XWikiContext(); + + XWikiDocumentArchive archive = new XWikiDocumentArchive(doc.getId()); + assertEquals(0, archive.getNodes().size()); + + String author = "some author"; + archive.updateArchive(author, new Date(), "initial, 1.1", false, doc.toXML(context), context); + String archive11 = archive.getArchive(context); + assertEquals(1, archive.getNodes().size()); + assertEquals(1, archive.getUpdeteNodeInfos().size()); + assertEquals(1, archive.getUpdeteNodeContents().size()); + + XWikiDocumentArchive archive2 = new XWikiDocumentArchive(doc.getId()); + archive2.setArchive(archive11); + assertEquals(archive11, archive2.getArchive(context)); + assertEquals(1, archive2.getNodes().size()); + assertEquals(1, archive2.getUpdeteNodeInfos().size()); + assertEquals(1, archive2.getUpdeteNodeContents().size()); + + doc.setContent("content\n1.2"); + archive.updateArchive(author, new Date(), "1.2", true, doc.toXML(context), context); + String archive12 = archive.getArchive(context); + assertEquals(2, archive.getNodes().size()); + assertEquals(2, archive.getUpdeteNodeInfos().size()); + assertEquals(2, archive.getUpdeteNodeContents().size()); + + XWikiDocumentArchive archive3 = new XWikiDocumentArchive(doc.getId()); + archive3.setArchive(archive12); + assertEquals(2, archive3.getNodes().size()); + assertEquals(2, archive3.getUpdeteNodeInfos().size()); + assertEquals(2, archive3.getUpdeteNodeContents().size()); + + doc.setContent("major change\ncontent\n2.1"); + archive.updateArchive(author, new Date(), "2.1", false, doc.toXML(context), context); + assertEquals(3, archive.getNodes().size()); + assertEquals(3, archive.getUpdeteNodeInfos().size()); + assertEquals(3, archive.getUpdeteNodeContents().size()); + } + + public void testJrcsQuote() throws Exception { + // test for http://www.suigeneris.org/issues/browse/JRCS-23 + Object[] text = {"qwe @ qwe", "qwe @@ qwe"}; + String log = "some bad @ log"; + Archive arch = new Archive(text, log); + String sarch = arch.toString(); + + Archive arch2 = new Archive("", new StringInputStream(sarch)); + assertEquals( sarch, arch2.toString() ); + assertTrue( Arrays.equals( text, arch2.getRevision() ) ); + assertEquals( log, arch2.getLog("1.1") ); + } } Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateBaseStore.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateBaseStore.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateBaseStore.java (working copy) @@ -32,7 +32,6 @@ import java.util.Map; import java.util.Iterator; import java.lang.reflect.Proxy; -import java.lang.reflect.InvocationHandler; public class XWikiHibernateBaseStore { private static final Log log = LogFactory.getLog(XWikiHibernateBaseStore.class); @@ -787,4 +786,51 @@ ""; return custommapping; } + + /** spring-jcr like Callback interface for working in hibernate */ + public interface HibernateCallBack { + Object doInHibernate(Session session) throws Exception; + } + + /** spring-jcr like execute method for operations in hibernate + * @throws XWikiException */ + public Object execute(XWikiContext context, boolean bTransaction, boolean doCommit, HibernateCallBack cb) throws XWikiException { + MonitorPlugin monitor = Util.getMonitorPlugin(context); + try { + // Start monitoring timer + if (monitor!=null) + monitor.startTimer("hibernate"); + + if (bTransaction) { + checkHibernate(context); + bTransaction = beginTransaction(context); + } + + return cb.doInHibernate(getSession(context)); + } catch (Exception e) { + if (e instanceof XWikiException) + throw (XWikiException)e; + throw new XWikiException( XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_UNKNOWN, + "Exception while hibernate execute", e); + } finally { + try { + if (bTransaction) + endTransaction(context, doCommit); + if (monitor!=null) + monitor.endTimer("hibernate"); + } catch (Exception e) {} + } + } + + /** spring-jcr like execute method for read-only operations in hibernate + * @throws XWikiException */ + public Object executeRead(XWikiContext context, boolean bTransaction, HibernateCallBack cb) throws XWikiException { + return execute(context, bTransaction, false, cb); + } + + /** spring-jcr like execute method for write operations in hibernate + * @throws XWikiException */ + public Object executeWrite(XWikiContext context, boolean bTransaction, HibernateCallBack cb) throws XWikiException { + return execute(context, bTransaction, true, cb); + } } Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java (working copy) @@ -26,6 +26,7 @@ import com.xpn.xwiki.doc.XWikiDocument; import com.xpn.xwiki.doc.XWikiLink; import com.xpn.xwiki.doc.XWikiLock; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo; import com.xpn.xwiki.monitor.api.MonitorPlugin; import com.xpn.xwiki.objects.*; import com.xpn.xwiki.objects.classes.BaseClass; @@ -531,7 +532,11 @@ deleteXWikiObject(obj, context, false); } } - + // Delete history + session.createQuery("delete from "+XWikiRCSNodeInfo.class.getName()+" where id.docId=?") + .setLong(0, doc.getId()) + .executeUpdate(); + session.delete(doc); // We need to ensure that the deleted document becomes the original document Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiVersioningStoreInterface.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiVersioningStoreInterface.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/store/XWikiVersioningStoreInterface.java (working copy) @@ -1,10 +1,14 @@ package com.xpn.xwiki.store; +import org.suigeneris.jrcs.rcs.Version; + import com.xpn.xwiki.XWikiContext; import com.xpn.xwiki.XWikiException; import com.xpn.xwiki.doc.XWikiDocument; import com.xpn.xwiki.doc.XWikiDocumentArchive; -import org.suigeneris.jrcs.rcs.Version; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeContent; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeId; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo; public interface XWikiVersioningStoreInterface { public void loadXWikiDocArchive(XWikiDocumentArchive archivedoc, boolean bTransaction, XWikiContext context) throws XWikiException; @@ -15,4 +19,8 @@ public XWikiDocument loadXWikiDoc(XWikiDocument doc, String version, XWikiContext context) throws XWikiException; public void resetRCSArchive(XWikiDocument doc, boolean bTransaction, XWikiContext context) throws XWikiException; public XWikiDocumentArchive getXWikiDocumentArchive(XWikiDocument doc, XWikiContext context) throws XWikiException; + /** + * Load {@link XWikiRCSNodeContent} by demand. Used in {@link XWikiRCSNodeInfo#getContent(XWikiContext)} + */ + public XWikiRCSNodeContent loadRCSNodeContent(XWikiContext context, XWikiRCSNodeId id, boolean bTransaction) throws XWikiException; } Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/store/jcr/XWikiJcrPropertyVersioningStore.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/store/jcr/XWikiJcrPropertyVersioningStore.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/store/jcr/XWikiJcrPropertyVersioningStore.java (working copy) @@ -1,34 +1,38 @@ package com.xpn.xwiki.store.jcr; +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; +import java.util.Iterator; + +import javax.jcr.Node; +import javax.jcr.PathNotFoundException; +import javax.jcr.Property; + +import org.suigeneris.jrcs.rcs.Version; + import com.xpn.xwiki.XWiki; import com.xpn.xwiki.XWikiContext; import com.xpn.xwiki.XWikiException; import com.xpn.xwiki.doc.XWikiDocument; import com.xpn.xwiki.doc.XWikiDocumentArchive; -import com.xpn.xwiki.monitor.api.MonitorPlugin; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeContent; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeId; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo; import com.xpn.xwiki.store.XWikiVersioningStoreInterface; -import com.xpn.xwiki.util.Util; -import org.suigeneris.jrcs.rcs.Archive; -import org.suigeneris.jrcs.rcs.Version; -import javax.jcr.Node; -import javax.jcr.PathNotFoundException; -import javax.jcr.Property; -import java.lang.reflect.InvocationTargetException; - /** Versions store in jcr property '@archive' of xwiki:document */ public class XWikiJcrPropertyVersioningStore extends XWikiJcrBaseStore implements XWikiVersioningStoreInterface { public XWikiJcrPropertyVersioningStore(XWiki xwiki, XWikiContext context) throws SecurityException, NoSuchMethodException, ClassNotFoundException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { super(xwiki, context); } - public void saveXWikiDocArchive(final XWikiDocumentArchive archivedoc, boolean bTransaction, XWikiContext context) throws XWikiException { + public void saveXWikiDocArchive(final XWikiDocumentArchive archivedoc, boolean bTransaction, final XWikiContext context) throws XWikiException { try { executeWrite(context, new JcrCallBack() { public Object doInJcr(XWikiJcrSession session) throws Exception { Node docNode = getDocNodeById(session, archivedoc.getId()); if (docNode==null) return null; - String s = archivedoc.getArchive(); + String s = archivedoc.getArchive(context); docNode.setProperty("archive", s); session.save(); return null; @@ -62,12 +66,14 @@ } // From XWikiHibernateVersioningStore: - public void resetRCSArchive(XWikiDocument doc, boolean bTransaction, XWikiContext context) throws XWikiException { try { XWikiDocumentArchive archivedoc = new XWikiDocumentArchive(doc.getId()); loadXWikiDocArchive(archivedoc, bTransaction, context); - archivedoc.resetArchive(doc.getFullName(), doc.getContent(), doc.getVersion()); + archivedoc.resetArchive(); + archivedoc.getDeleteNodeInfo().clear(); + doc.setMinorEdit(false); + updateXWikiDocArchive(doc, doc.toXML(context), false, context); saveXWikiDocArchive(archivedoc, bTransaction, context); } catch (Exception e) { Object[] args = { doc.getFullName() }; @@ -81,7 +87,7 @@ public void updateXWikiDocArchive(XWikiDocument doc, String text, boolean bTransaction, XWikiContext context) throws XWikiException { try { XWikiDocumentArchive archivedoc = getXWikiDocumentArchive(doc, context); - archivedoc.updateArchive(doc.getFullName(), text); + archivedoc.updateArchive(doc.getContentAuthor(), doc.getDate(), doc.getComment(), doc.isMinorEdit(), text, context); saveXWikiDocArchive(archivedoc, bTransaction, context); } catch (Exception e) { Object[] args = { doc.getFullName() }; @@ -91,6 +97,8 @@ } public XWikiDocument loadXWikiDoc(XWikiDocument basedoc, String version, XWikiContext context) throws XWikiException { + return null; + /* TODO: it will be rewrited XWikiDocument doc = new XWikiDocument(basedoc.getSpace(), basedoc.getName()); doc.setDatabase(basedoc.getDatabase()); MonitorPlugin monitor = Util.getMonitorPlugin(context); @@ -139,20 +147,21 @@ if (monitor!=null) monitor.endTimer("jcr"); } - return doc; + return doc;*/ } public Version[] getXWikiDocVersions(XWikiDocument doc, XWikiContext context) throws XWikiException { try { - Archive archive = getXWikiDocumentArchive(doc, context).getRCSArchive(); + XWikiDocumentArchive archive = getXWikiDocumentArchive(doc, context); if (archive==null) return new Version[0]; - - org.suigeneris.jrcs.rcs.Node[] nodes = archive.changeLog(); - Version[] versions = new Version[nodes.length]; - for (int i=0;i0) { + for (Iterator it = nodeInfos.iterator(); it.hasNext(); ) { + XWikiRCSNodeInfo nodeinfo = (XWikiRCSNodeInfo) it.next(); + XWikiRCSNode node = new XWikiRCSNode(nodeinfo.getId().getVersion(), null); + // bug if author=="" + node.setAuthor( "".equals(nodeinfo.getAuthor()) ? "_" : nodeinfo.getAuthor() ); + node.setDate(nodeinfo.getDate()); + node.setLog(nodeinfo.getComment()); + XWikiRCSNodeContent content = nodeinfo.getContent(context); + node.setText(content.getDelta()); + nodes.put(node.getVersion(), node); + } + XWikiRCSNode last = null; + for (Iterator it = nodes.keySet().iterator(); it.hasNext(); ) { + Version ver = (Version) it.next(); + XWikiRCSNode node = (XWikiRCSNode) nodes.get(ver); + if (last!=null) + last.setRCSNext(node); + last = node; + if (head==null) + head = node; + } + } + } + public XWikiRCSArchive(String archivetext) throws ParseException + { + super("", new StringInputStream(archivetext)); + } + + private static class XWikiRCSNode extends TrunkNode { + public XWikiRCSNode(Version vernum, TrunkNode next) + throws InvalidTrunkVersionNumberException + { + super(vernum, next); + } + public void setDate(Date date) { + this.date = date; + } + } + + /** + * @return Collection of pairs [{@link XWikiRCSNodeInfo}, {@link XWikiRCSNodeContent}] + * @throws XWikiException + */ + public Collection getNodes(long docId) throws XWikiException { + Collection result = new ArrayList(nodes.values().size()); + for (Iterator it = nodes.values().iterator(); it.hasNext(); ) { + Node node = (Node) it.next(); + XWikiRCSNodeInfo nodeinfo = new XWikiRCSNodeInfo(); + nodeinfo.setId(new XWikiRCSNodeId(docId, node.getVersion())); + nodeinfo.setAuthor( "_".equals(node.getAuthor()) ? "" : node.getAuthor() ); + nodeinfo.setComment(node.getLog()); + nodeinfo.setDate(node.getDate()); + XWikiRCSNodeContent content = new XWikiRCSNodeContent(nodeinfo.getId()); + content.setDelta(ToString.arrayToString(node.getText())); + nodeinfo.setContent(content); + result.add(nodeinfo); + result.add(content); + } + return result; + } +} Property changes on: xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSArchive.java ___________________________________________________________________ Name: svn:eol-style + native Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSNodeId.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSNodeId.java (revision 0) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSNodeId.java (revision 0) @@ -0,0 +1,119 @@ +/* + * Copyright 2007, XpertNet SARL, and individual contributors as indicated + * by the contributors.txt. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + * + */ +package com.xpn.xwiki.doc.rcs; + +import java.io.Serializable; + +import org.suigeneris.jrcs.rcs.Version; + +/** + * composite ID component used in {@link XWikiRCSNodeInfo} & {@link XWikiRCSNodeContent} + * */ +public class XWikiRCSNodeId implements Serializable +{ + // composite-key + private long docId; + private Version version = new Version(1,1); + + public XWikiRCSNodeId() {} + + public XWikiRCSNodeId(long docId, Version version) + { + super(); + this.docId = docId; + this.version = version; + } + + public XWikiRCSNodeId(XWikiRCSNodeId node) + { + this(node.getDocId(), node.getVersion()); + } + + public long getDocId() + { + return docId; + } + + public void setDocId(long docId) + { + this.docId = docId; + } + + public Version getVersion() + { + return version; + } + protected int getVersion1() + { + return version.at(0); + } + protected int getVersion2() + { + return version.at(1); + } + + public void setVersion(Version ver) + { + this.version = ver; + } + protected void setVersion1(int v1) + { + this.version = new Version(v1, version.at(1)); + } + protected void setVersion2(int v2) + { + this.version = new Version(version.at(0), v2); + } + + // generated by eclipse + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + (int) (docId ^ (docId >>> 32)); + result = prime * result + ((version == null) ? 0 : version.hashCode()); + return result; + } + + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final XWikiRCSNodeId other = (XWikiRCSNodeId) obj; + if (docId != other.docId) + return false; + if (version == null) { + if (other.version != null) + return false; + } else if (!version.equals(other.version)) + return false; + return true; + } + + public Object clone() + { + return new XWikiRCSNodeId(this); + } +} Property changes on: xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSNodeId.java ___________________________________________________________________ Name: svn:eol-style + native Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java (working copy) @@ -28,6 +28,7 @@ import com.xpn.xwiki.content.parsers.ReplacementResultCollection; import com.xpn.xwiki.content.parsers.RenamePageReplaceLinkHandler; import com.xpn.xwiki.content.Link; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo; import com.xpn.xwiki.api.DocumentSection; import com.xpn.xwiki.notify.XWikiNotificationRule; import com.xpn.xwiki.objects.BaseCollection; @@ -156,6 +157,9 @@ // Comment on the latest modification private String comment; + + // Is latest modification is minor edit + private boolean isMinorEdit = false; // Used to make sure the MetaData String is regenerated private boolean isContentDirty = true; @@ -291,7 +295,9 @@ public Version getRCSVersion() { if (version == null) { - version = new Version("1.1"); + // if we assign this.version = new Version("1.1") before save (ex: $doc.getVersion() in a page), then version will be > 1.1 after the first save + // version 1.0 do not work for some reason inside JRCS + return new Version("1.1"); } return version; } @@ -669,7 +675,11 @@ if (version == null) { version = new Version("1.1"); } else { - version = version.next(); + if (isMinorEdit()) { + version = version.next(); + } else { + version = version.getBranchPoint().next().newBranch(1); + } } } @@ -885,6 +895,11 @@ } } + public XWikiRCSNodeInfo getRevisionInfo(String version, XWikiContext context) throws XWikiException + { + return getDocumentArchive(context).getNode(new Version(version)); + } + public boolean isMostRecent() { return mostRecent; @@ -1548,7 +1563,10 @@ if (comment != null) { setComment(comment); } - + + // Read the minor edit checkbox from the form + setMinorEdit(eform.isMinorEdit()); + String tags = eform.getTags(); if (tags != null) { setTags(tags, context); @@ -1786,6 +1804,7 @@ setxWikiClass((BaseClass) document.getxWikiClass().clone()); setxWikiClassXML(document.getxWikiClassXML()); setComment(document.getComment()); + setMinorEdit(document.isMinorEdit()); clonexWikiObjects(document); copyAttachments(document); @@ -1835,6 +1854,7 @@ doc.setxWikiClass((BaseClass) getxWikiClass().clone()); doc.setxWikiClassXML(getxWikiClassXML()); doc.setComment(getComment()); + doc.setMinorEdit(isMinorEdit()); doc.clonexWikiObjects(this); doc.copyAttachments(this); doc.elements = elements; @@ -1960,6 +1980,10 @@ if (!getComment().equals(doc.getComment())) { return false; } + + if (isMinorEdit() == doc.isMinorEdit()) { + return false; + } if (!getxWikiClass().equals(doc.getxWikiClass())) { return false; @@ -2078,7 +2102,7 @@ Document doc = new DOMDocument(); Element docel = new DOMElement("xwikidoc"); doc.setRootElement(docel); - + Element el = new DOMElement("web"); el.addText(getSpace()); docel.add(el); @@ -2154,16 +2178,22 @@ el.addText(getValidationScript()); docel.add(el); + /* comment and minorEdit moved in XWikiRCSNodeInfo el = new DOMElement("comment"); el.addText(getComment()); docel.add(el); - + + el = new DOMElement("minorEdit"); + el.addText(String.valueOf(isMinorEdit())); + docel.add(el); + */ + List alist = getAttachmentList(); for (int ai = 0; ai < alist.size(); ai++) { XWikiAttachment attach = (XWikiAttachment) alist.get(ai); docel.add(attach.toXML(bWithAttachmentContent, bWithVersions, context)); } - + if (bWithObjects) { // Add Class BaseClass bclass = getxWikiClass(); @@ -2213,7 +2243,7 @@ if (bWithVersions) { el = new DOMElement("versions"); try { - el.addText(getDocumentArchive(context).getArchive()); + el.addText(getDocumentArchive(context).getArchive( context )); } catch (XWikiException e) { return null; } @@ -2222,7 +2252,7 @@ return doc; } - + protected String encodedXMLStringAsUTF8(String xmlString) { if (xmlString == null) { @@ -2341,6 +2371,9 @@ setValidationScript(getElement(docel, "validationScript")); setComment(getElement(docel, "comment")); + String minorEdit = getElement(docel, "minorEdit"); + setMinorEdit(Boolean.valueOf(minorEdit).booleanValue()); + String strans = getElement(docel, "translation"); if ((strans == null) || strans.equals("")) { setTranslation(0); @@ -4052,6 +4085,26 @@ this.comment = comment; setMetaDataDirty(true); } + + public boolean isMinorEdit() + { + return isMinorEdit; + } + public void setMinorEdit(boolean isMinor) + { + this.isMinorEdit = isMinor; + setMetaDataDirty(true); + } + + // methods for easy table update. because default value == null + protected Boolean getMinorEdit1() + { + return Boolean.valueOf(isMinorEdit); + } + protected void setMinorEdit1(Boolean isMinor) + { + isMinorEdit = (isMinor!=null && isMinor.booleanValue()); + } public BaseObject newObject(String classname, XWikiContext context) throws XWikiException { Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/XWikiDocumentArchive.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/XWikiDocumentArchive.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/doc/XWikiDocumentArchive.java (working copy) @@ -1,17 +1,103 @@ +/* + * Copyright 2006-2007, XpertNet SARL, and individual contributors as indicated + * by the contributors.txt. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + * + */ package com.xpn.xwiki.doc; -import com.xpn.xwiki.XWikiException; +import java.util.Collection; +import java.util.Comparator; +import java.util.Date; +import java.util.Iterator; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.TreeSet; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.tools.ant.filters.StringInputStream; -import org.suigeneris.jrcs.rcs.Archive; -import org.suigeneris.jrcs.util.ToString; +import org.suigeneris.jrcs.diff.DifferentiationFailedException; +import org.suigeneris.jrcs.rcs.Version; +import org.suigeneris.jrcs.rcs.parse.ParseException; +import com.xpn.xwiki.XWikiContext; +import com.xpn.xwiki.XWikiException; +import com.xpn.xwiki.doc.rcs.XWikiDiff; +import com.xpn.xwiki.doc.rcs.XWikiRCSArchive; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeContent; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeId; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo; +import com.xpn.xwiki.plugin.packaging.PackagePlugin; +/** + * Contains document history. + * Allows to load any version of document + */ public class XWikiDocumentArchive { private static final Log log = LogFactory.getLog(XWikiDocumentArchive.class); + // docId private long id; - private Archive archive; + + private SortedMap versionToNode = new TreeMap(); + + // store-specific information + private Set deleteNodes = new TreeSet(); + private Set updateNodeInfos = new TreeSet(new Comparator() { + public int compare(Object arg0, Object arg1) + { + XWikiRCSNodeInfo o1 = (XWikiRCSNodeInfo) arg0; + XWikiRCSNodeInfo o2 = (XWikiRCSNodeInfo) arg1; + return o1.getId().getVersion().compareTo(o2.getId().getVersion()); + } + }); + private Set updateNodeContents = new TreeSet(new Comparator() { + public int compare(Object arg0, Object arg1) + { + XWikiRCSNodeContent o1 = (XWikiRCSNodeContent) arg0; + XWikiRCSNodeContent o2 = (XWikiRCSNodeContent) arg1; + return o1.getId().getVersion().compareTo(o2.getId().getVersion()); + } + }); + + // helper methods + protected Version getNextVersion(Version cur, boolean isMinor) { + if (!isMinor) + return cur.getBase(1).next().newBranch(1); + else + return cur.next(); + } + protected void addNode(XWikiRCSNodeInfo node) { + versionToNode.put(node.getId().getVersion(), node); + } + protected XWikiRCSNodeId newNodeId(Version ver) { + return new XWikiRCSNodeId(getId(), ver); + } + protected XWikiRCSNodeContent makeDiffs(XWikiRCSNodeContent latestcontent, String text) throws DifferentiationFailedException, XWikiException + { + XWikiRCSNodeContent result = new XWikiRCSNodeContent(); + if (latestcontent==null) { + result.setDelta( text ); + } else { + result.setDelta(text); + latestcontent.setDelta( XWikiDiff.diff(latestcontent.getDelta(), text) ); + } + return result; + } public XWikiDocumentArchive() { } @@ -27,123 +113,127 @@ public void setId(long id) { this.id = id; } - - public Archive getRCSArchive() { - return archive; + + /** get collection of XWikiRCSNodeInfo order by version desc */ + public Collection getNodes() { + return versionToNode.values(); } - - public void setRCSArchive(Archive archive) { - this.archive = archive; + /** @param versions - collection of XWikiRCSNodeInfo */ + public void setNodes(Collection versions) { + resetArchive(); + for (Iterator it = versions.iterator(); it.hasNext(); ) + addNode((XWikiRCSNodeInfo) it.next()); } - public String getArchive() throws XWikiException { - if (archive == null) - return ""; - else { - StringBuffer buffer = new StringBuffer(); - archive.toString(buffer); - return buffer.toString(); - } + /** + * @return serialization of class + * used in {@link PackagePlugin} + * @throws XWikiException + * */ + public String getArchive(XWikiContext context) throws XWikiException { + XWikiRCSArchive archive = new XWikiRCSArchive(getNodes(), context); + return archive.toString(); } - + /** + * deserialize class + * used in {@link PackagePlugin} + * @throws XWikiException + */ public void setArchive(String text) throws XWikiException { + XWikiRCSArchive archive; try { - if ((text!=null)&&(!text.trim().equals(""))) { - StringInputStream is = new StringInputStream(text); - archive = new Archive("", is); - } else - if (text == null){ - Object[] lines = new Object[1]; - lines[0] = ""; - archive = new Archive(lines, "", "1.0"); - } - else - { - Object[] lines = ToString.stringToArray(text); - archive = new Archive(lines, "", "1.0"); - } + archive = new XWikiRCSArchive(text); + } catch (ParseException e) { + throw new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_CONTENT_ERROR, "Exception while constructing document archive", e); } - catch (Exception e) { - Object[] args = { "" }; - throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_ARCHIVEFORMAT, - "Exception while manipulating the archive for doc {0}", e, args); + resetArchive(); + Collection nodes = archive.getNodes(getId()); + for (Iterator it=nodes.iterator(); it.hasNext(); ) { + XWikiRCSNodeInfo nodeinfo = (XWikiRCSNodeInfo) it.next(); + XWikiRCSNodeContent nodecontent = (XWikiRCSNodeContent) it.next(); + addNode(nodeinfo); + updateNodeInfos.add(nodeinfo); + updateNodeContents.add(nodecontent); } } - public void updateArchive(String docname, String text) throws XWikiException { - - // JRCS used the user.name System property to set the author of a change. However JRCS - // has a bug when the user name has a space in the name - // (see http://www.suigeneris.org/issues/browse/JRCS-22). The workaround is to set the - // user.name System property to some user without a space in its name. In addition - // we're not using that information anywhere so it won't matter. When JRCS bug is fixed - // remove this hack. - - // Saving the property in case some other part of the code or some dependent framework - // needs it. - String originalUsername = System.getProperty("user.name"); - - System.setProperty("user.name", "xwiki"); - + public void updateArchive(String author, Date date, String comment, boolean isMinor, String text, XWikiContext context) throws XWikiException { try { - Object[] lines = ToString.stringToArray(text); - if (archive != null) - archive.addRevision(lines, ""); - else - archive = new Archive(lines, docname, "1.0"); + if (versionToNode.size()>0) { + XWikiRCSNodeInfo orignode = getLatestNode(); + + XWikiRCSNodeInfo newnode = new XWikiRCSNodeInfo(); + newnode.setId( newNodeId( getNextVersion( orignode.getId().getVersion(), isMinor) ) ); + newnode.setComment(comment); + newnode.setAuthor(author); + newnode.setDate(date); + + XWikiRCSNodeContent origcontent = orignode.getContent(context); + XWikiRCSNodeContent newcontent = makeDiffs(origcontent, text); + newnode.setContent(newcontent); + + addNode(newnode); + updateNodeInfos.add(newnode); + updateNodeContents.add(newcontent); + updateNodeContents.add(origcontent); + } else { + XWikiRCSNodeInfo newnode = new XWikiRCSNodeInfo(new XWikiRCSNodeId(id, new Version(1,1))); + newnode.setAuthor(author); + newnode.setDate(date); + newnode.setComment(comment); + XWikiRCSNodeContent newcontent = makeDiffs(null, text); + newnode.setContent(newcontent); + addNode(newnode); + updateNodeInfos.add(newnode); + updateNodeContents.add(newcontent); + } + } catch (DifferentiationFailedException e) { + Object[] args = new Object[]{Long.valueOf(getId())}; + throw new XWikiException(XWikiException.MODULE_XWIKI_DIFF, XWikiException.ERROR_XWIKI_DIFF_CONTENT_ERROR, "Exception while updateArchive for docId={}", e, args); } - catch (Exception e) { - Object[] args = { docname }; - throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_ARCHIVEFORMAT, - "Exception while manipulating the archive for doc {0}", e, args); - } finally { - // Restore the user name to its original value - System.setProperty("user.name", originalUsername); - } - } - public Object clone() { - XWikiDocumentArchive docarchive = null; - try { - docarchive = (XWikiDocumentArchive) getClass().newInstance(); - } catch (Exception e) { - // This should not happen - } - - docarchive.setId(getId()); - docarchive.setRCSArchive(getRCSArchive()); - return docarchive; + public XWikiRCSNodeInfo getNode(Version version) + { + return (XWikiRCSNodeInfo) versionToNode.get(version); } - - - public boolean equals(Object object) { - XWikiDocumentArchive doc = (XWikiDocumentArchive) object; - if (getId()!=doc.getId()) - return false; - - try { - if (!getArchive().equals(doc.getArchive())) - return false; - } catch (XWikiException e) { - return false; - } - - return true; + + public Version getLatestVersion() + { + return (Version) versionToNode.firstKey(); } - - public void resetArchive(String docname, String text, String version) throws XWikiException { - Object[] lines = ToString.stringToArray(text); - archive = new Archive(lines, docname, version); + + public XWikiRCSNodeInfo getLatestNode() { + return getNode( getLatestVersion() ); } - + + public void resetArchive() + { + versionToNode.clear(); + deleteNodes.addAll(updateNodeInfos); + updateNodeInfos.clear(); + updateNodeContents.clear(); + } + /** - * {@inheritDoc} - * @see Object#toString() + * @return mutable Set of {@link XWikiRCSNodeInfo} which are need for delete */ - public String toString() + public Set getDeleteNodeInfo() { - return "id = [" + getId() + "], archive = [" - + (getRCSArchive() == null ? "null" : getRCSArchive().toString()) + "]"; + return deleteNodes; } + /** + * @return mutable Set of {@link XWikiRCSNodeInfo} which are need for saveOrUpdate + */ + public Set getUpdeteNodeInfos() + { + return updateNodeInfos; + } + /** + * @return mutable Set of {@link XWikiRCSNodeContent} which are need for update + */ + public Set getUpdeteNodeContents() + { + return updateNodeContents; + } } Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/api/RevisionInfo.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/api/RevisionInfo.java (revision 0) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/api/RevisionInfo.java (revision 0) @@ -0,0 +1,64 @@ +/* + * Copyright 2007, XpertNet SARL, and individual contributors as indicated + * by the contributors.txt. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + * + */ +package com.xpn.xwiki.api; + +import java.util.Date; + +import com.xpn.xwiki.XWikiContext; +import com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo; + +/** + * API object for get info about some version of Document + */ +public class RevisionInfo extends Api +{ + XWikiRCSNodeInfo nodeInfo; + + public RevisionInfo(XWikiRCSNodeInfo nodeInfo, XWikiContext context) + { + super(context); + this.nodeInfo = nodeInfo; + } + + public String getVersion() + { + return nodeInfo.getId().getVersion().toString(); + } + + public Date getDate() + { + return nodeInfo.getDate(); + } + + public String getAuthor() + { + return nodeInfo.getAuthor(); + } + + public String getComment() + { + return nodeInfo.getComment(); + } + + public boolean isMinorEdit() { + return nodeInfo.isMinorEdit(); + } +} Property changes on: xwiki-platform-core/src/main/java/com/xpn/xwiki/api/RevisionInfo.java ___________________________________________________________________ Name: svn:eol-style + native Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/api/XWiki.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/api/XWiki.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/api/XWiki.java (working copy) @@ -34,7 +34,7 @@ import com.xpn.xwiki.stats.impl.DocumentStats; import com.xpn.xwiki.web.Utils; import com.xpn.xwiki.web.XWikiEngineContext; -import org.suigeneris.jrcs.diff.Chunk; +import org.suigeneris.jrcs.diff.delta.Chunk; import java.awt.image.BufferedImage; import java.io.IOException; @@ -2320,6 +2320,14 @@ { return xwiki.isEditCommentMandatory(context); } + + /** + * API to check if the minor edit feature is active + * minor edit are activated in xwiki.cfg or in the XWiki Preferences + */ + public boolean hasMinorEdit() { + return xwiki.hasMinorEdit(context); + } /** * API to rename a page (experimental) Rights are necessary to edit the source and target page Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/api/Document.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/api/Document.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/api/Document.java (working copy) @@ -280,6 +280,11 @@ { return doc.getComment(); } + + public boolean isMinorEdit() + { + return doc.isMinorEdit(); + } /** * return the list of possible traduction for this document @@ -354,7 +359,7 @@ */ public String getArchive() throws XWikiException { - return doc.getDocumentArchive(getXWikiContext()).getArchive(); + return doc.getDocumentArchive(getXWikiContext()).getArchive(getXWikiContext()); } /** @@ -680,6 +685,10 @@ { return doc.getRecentRevisions(nb, getXWikiContext()); } + + public RevisionInfo getRevisionInfo(String version) throws XWikiException { + return new RevisionInfo( doc.getRevisionInfo(version, getXWikiContext()), getXWikiContext() ); + } public List getAttachmentList() { @@ -1398,6 +1407,10 @@ { getDoc().setComment(comment); } + + public void setMinorEdit(boolean isMinor) { + getDoc().setMinorEdit(isMinor); + } public void save() throws XWikiException { Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/XWiki.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/XWiki.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/XWiki.java (working copy) @@ -901,8 +901,14 @@ // If no comment is provided we should use an empty comment saveDocument(doc, "", context); } + + public void saveDocument(XWikiDocument doc, String comment, XWikiContext context) + throws XWikiException + { + saveDocument(doc, comment, false, context); + } - public void saveDocument(XWikiDocument doc, String comment, XWikiContext context) + public void saveDocument(XWikiDocument doc, String comment, boolean isMinorEdit, XWikiContext context) throws XWikiException { String server = null, database = null; @@ -916,6 +922,7 @@ // Setting comment before saving doc.setComment((comment == null) ? "" : comment); + doc.setMinorEdit(isMinorEdit); getStore().saveXWikiDoc(doc, context); @@ -4899,6 +4906,16 @@ return false; return "1".equals(Param("xwiki.editcomment.mandatory", "0")); } + + public boolean hasMinorEdit(XWikiContext context) + { + String bl = getXWikiPreference("minoredit", "", context); + if ("1".equals(bl)) + return true; + if ("0".equals(bl)) + return false; + return "1".equals(Param("xwiki.minoredit", "1")); + } /** * @deprecated use {@link XWikiDocument#rename(String, XWikiContext)} instead Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/web/EditForm.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/web/EditForm.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/web/EditForm.java (working copy) @@ -50,11 +50,13 @@ private String title; private String comment; + + private boolean isMinorEdit = false; private String tags; private boolean lockForce; - + public void readRequest() { XWikiRequest request = getRequest(); @@ -71,6 +73,7 @@ setDefaultLanguage(request.getParameter("default_language")); setTags(request.getParameterValues("tags")); setLockForce("1".equals(request.getParameter("force"))); + setMinorEdit(request.getParameter("minor_edit")!=null); } public void setTags(String[] parameter) @@ -231,6 +234,16 @@ { this.comment = comment; } + + public boolean isMinorEdit() + { + return isMinorEdit; + } + + public void setMinorEdit(boolean isMinorEdit) + { + this.isMinorEdit = isMinorEdit; + } public boolean isLockForce() { Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/web/CommentAddAction.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/web/CommentAddAction.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/web/CommentAddAction.java (working copy) @@ -55,7 +55,7 @@ newobject.setNumber(oldobject.getNumber()); newobject.setName(doc.getFullName()); doc.setObject(className, nb, newobject); - xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.addComment"), context); + xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.addComment"), true, context); } // forward to edit String redirect = Utils.getRedirect("edit", context); Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/web/ObjectRemoveAction.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/web/ObjectRemoveAction.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/web/ObjectRemoveAction.java (working copy) @@ -43,7 +43,7 @@ objects.set(classId, null); doc.addObjectsToRemove(object); doc.setAuthor(context.getUser()); - xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.deleteObject"), context); + xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.deleteObject"), true, context); // forward to edit String redirect = Utils.getRedirect("edit", context); Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/web/SaveAction.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/web/SaveAction.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/web/SaveAction.java (working copy) @@ -95,6 +95,7 @@ tdoc.setContent(content); tdoc.setTitle(title); tdoc.setComment(sectionDoc.getComment()); + tdoc.setMinorEdit(sectionDoc.isMinorEdit()); }else{ tdoc.readFromForm((EditForm) form, context); } @@ -110,7 +111,7 @@ // We get the comment to be used from the document // It was read using readFromForm - xwiki.saveDocument(tdoc, tdoc.getComment(), context); + xwiki.saveDocument(tdoc, tdoc.getComment(), tdoc.isMinorEdit(), context); XWikiLock lock = tdoc.getLock(context); if (lock != null) tdoc.removeLock(context); Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/web/PropAddAction.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/web/PropAddAction.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/web/PropAddAction.java (working copy) @@ -62,7 +62,7 @@ if (doc.isNew()) { doc.setCreator(username); } - xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.addClassProperty"), context); + xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.addClassProperty"), true, context); } } // forward to edit Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/web/ObjectAddAction.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/web/ObjectAddAction.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/web/ObjectAddAction.java (working copy) @@ -63,7 +63,7 @@ if (doc.isNew()) { doc.setCreator(username); } - xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.addObject"), context); + xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.addObject"), true, context); // forward to edit String redirect = Utils.getRedirect("edit", context); Index: xwiki-platform-core/src/main/java/com/xpn/xwiki/web/PropUpdateAction.java =================================================================== --- xwiki-platform-core/src/main/java/com/xpn/xwiki/web/PropUpdateAction.java (revision 4018) +++ xwiki-platform-core/src/main/java/com/xpn/xwiki/web/PropUpdateAction.java (working copy) @@ -75,7 +75,7 @@ doc.setxWikiClass(bclass2); doc.renameProperties(bclass.getName(), fieldsToRename); - xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.updateClassProperty"), context); + xwiki.saveDocument(doc, context.getMessageTool().get("core.comment.updateClassProperty"), true, context); // We need to load all documents that use this property and rename it if (fieldsToRename.size() > 0) { @@ -88,7 +88,7 @@ for (int i = 0; i < list.size(); i++) { XWikiDocument doc2 = xwiki.getDocument((String) list.get(i), context); doc2.renameProperties(bclass.getName(), fieldsToRename); - xwiki.saveDocument(doc2, context.getMessageTool().get("core.comment.updateClassPropertyName"), context); + xwiki.saveDocument(doc2, context.getMessageTool().get("core.comment.updateClassPropertyName"), true, context); } } xwiki.flushCache(); Index: xwiki-platform-core/src/main/resources/ApplicationResources.properties =================================================================== --- xwiki-platform-core/src/main/resources/ApplicationResources.properties (revision 4018) +++ xwiki-platform-core/src/main/resources/ApplicationResources.properties (working copy) @@ -702,6 +702,10 @@ core.comment.rollback=Rollback to version {0} core.comment.updateContent=Update Content +core.minoredit=Is minor edit +core.minoredit.show=Show minor edits +core.minoredit.hide=Hide minor edits + # top menu core.menu.documentation=Documentation core.menu.create=Create Index: xwiki-platform-core/src/main/resources/xwiki.oracle.hbm.xml =================================================================== --- xwiki-platform-core/src/main/resources/xwiki.oracle.hbm.xml (revision 4018) +++ xwiki-platform-core/src/main/resources/xwiki.oracle.hbm.xml (working copy) @@ -101,17 +101,33 @@ + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + Index: xwiki-platform-core/src/main/resources/xwiki.derby.hbm.xml =================================================================== --- xwiki-platform-core/src/main/resources/xwiki.derby.hbm.xml (revision 4018) +++ xwiki-platform-core/src/main/resources/xwiki.derby.hbm.xml (working copy) @@ -107,17 +107,33 @@ + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + Index: xwiki-platform-core/src/main/resources/xwiki.hbm.xml =================================================================== --- xwiki-platform-core/src/main/resources/xwiki.hbm.xml (revision 4018) +++ xwiki-platform-core/src/main/resources/xwiki.hbm.xml (working copy) @@ -99,17 +99,29 @@ + + + - - - - - - - - + + + + + + + + + + + + + + + + + Index: xwiki-platform-core/pom.xml =================================================================== --- xwiki-platform-core/pom.xml (revision 4018) +++ xwiki-platform-core/pom.xml (working copy) @@ -83,13 +83,13 @@ org.suigeneris jrcs.diff - 0.3.0 + 0.4.1 xwiki org.suigeneris jrcs.rcs - 0.3.0 + 0.4.1 xwiki @@ -560,4 +560,4 @@ - \ No newline at end of file +