Index: src/main/java/com/xpn/xwiki/doc/XWikiDocument.java =================================================================== --- src/main/java/com/xpn/xwiki/doc/XWikiDocument.java (revision 4194) +++ src/main/java/com/xpn/xwiki/doc/XWikiDocument.java (working copy) @@ -301,7 +301,7 @@ public Version getRCSVersion() { if (version == null) { - version = new Version("1.0"); + return new Version("1.1"); } return version; } Index: src/main/java/com/xpn/xwiki/doc/XWikiDocumentArchive.java =================================================================== --- src/main/java/com/xpn/xwiki/doc/XWikiDocumentArchive.java (revision 4194) +++ src/main/java/com/xpn/xwiki/doc/XWikiDocumentArchive.java (working copy) @@ -1,12 +1,19 @@ package com.xpn.xwiki.doc; +import com.xpn.xwiki.XWikiContext; import com.xpn.xwiki.XWikiException; 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.rcs.Node; +import org.suigeneris.jrcs.rcs.Version; import org.suigeneris.jrcs.util.ToString; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + public class XWikiDocumentArchive { private static final Log log = LogFactory.getLog(XWikiDocumentArchive.class); @@ -71,7 +78,11 @@ } public void updateArchive(String docname, String text) throws XWikiException { + updateArchive(docname, text, "1.0"); + } + public void updateArchive(String docname, String text, String version) 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 @@ -90,7 +101,7 @@ if (archive != null) archive.addRevision(lines, ""); else - archive = new Archive(lines, docname, "1.0"); + archive = new Archive(lines, docname, version); } catch (Exception e) { Object[] args = { docname }; @@ -146,4 +157,83 @@ return "id = [" + getId() + "], archive = [" + (getRCSArchive() == null ? "null" : getRCSArchive().toString()) + "]"; } + + public String getRevision(String version) throws XWikiException { + return getRevision(new Version(version)); + } + + public String getRevision(Version version) throws XWikiException { + try { + Object[] text = archive.getRevision(version); + StringBuffer content = new StringBuffer(); + for (int i=0;i