Package org.tmatesoft.svn.core.io

Examples of org.tmatesoft.svn.core.io.ISVNEditor

@version 1.3 @author TMate Software Ltd. @since 1.2 @see ISVNReporterBaton @see Examples

                            "Expected ''revprops'', found ''{0}''", word);
                    SVNErrorManager.error(err, SVNLogType.NETWORK);
                }
               
                SVNProperties revProps = SVNReader.getProperties(items, 1, null);
                ISVNEditor editor = handler.handleStartRevision(rev, revProps);
                SVNEditModeReader editReader = new SVNEditModeReader(myConnection, editor, true);
                editReader.driveEditor();
                handler.handleEndRevision(rev, revProps, editor);
            }
            read("", null, false);
View Full Code Here


        // set database URL as property on root of repository if database was
        // created or if new subversion repo created
        if (dbCreated || repoCreated) {
            Map<String, String> props = new HashMap<String, String>();
            props.put(Params.Svn.DBURLPROP, dbUrl);
            ISVNEditor editor = getEditor("Setting " + Params.Svn.DBURLPROP + " to " + dbUrl);
            editor.openRoot(-1);
            SvnUtils.modifyFileProps(editor, "/", props);
            editor.closeDir();
            SVNCommitInfo info = editor.closeEdit();
            if (Log.isDebugEnabled(Geonet.SVN_MANAGER))
                Log.debug(Geonet.SVN_MANAGER, "Committed " + dbUrl + " as property " + Params.Svn.DBURLPROP + ":" + info);
        } else {
            // get database URL from root of repository and check against dbUrl
            // if it doesn't match then stop
View Full Code Here

            return;
        }
        TransactionStatus status = (TransactionStatus) joinPoint.getArgs()[0];
        SvnTask task = tasks.get(status);

        ISVNEditor editor = null;

        if (task != null) {
            try {
                editor = getEditor(task.sessionLogMessage + " (committing transaction " + status + ")");
                editor.openRoot(-1); // open the root directory.
                for (Iterator<String> it = task.ids.iterator(); it.hasNext(); ) {
                    String id = it.next();
                    commitMetadata(id, editor);
                    it.remove();
                }
                editor.closeDir(); // close the root directory.
                if (Log.isDebugEnabled(Geonet.SVN_MANAGER))
                    Log.debug(Geonet.SVN_MANAGER, "Committed changes to subversion repository for metadata ids " + task.ids);
            } catch (Exception e) {
                Log.error(Geonet.SVN_MANAGER, "Failed to commit changes to subversion repository for metadata ids " + task.ids);
                e.printStackTrace();
                if (editor != null) {
                    try {
                        editor.abortEdit();
                    } catch (Exception ex) {
                        Log.error(Geonet.SVN_MANAGER, "Failed to abort subversion editor");
                        ex.printStackTrace();
                    }
                }
View Full Code Here

        String logMessage = sessionToLogMessage(context) + " adding directory for metadata " + id;
        if (Log.isDebugEnabled(Geonet.SVN_MANAGER))
            Log.debug(Geonet.SVN_MANAGER, logMessage);

        ISVNEditor editor = getEditor(logMessage);

        try {
            // Create an id/ directory item in the repository
            editor.openRoot(-1);
            SvnUtils.addDir(editor, id);
            if (Log.isDebugEnabled(Geonet.SVN_MANAGER))
                Log.debug(Geonet.SVN_MANAGER, "Directory for metadata " + id + " was added");
            editor.closeDir();
            editor.closeEdit();
        } catch (SVNException svne) {
            editor.abortEdit();
            svne.printStackTrace();
            throw svne;
        }

        // Add the id/metadata.xml item plus properties to the repository
        try {
            logMessage = sessionToLogMessage(context) + " adding initial version of metadata " + id;
            editor = getEditor(logMessage);
            editor.openRoot(-1);
            final ISVNEditor finalEditor = editor;

            commitMetadata(id, finalEditor);

            if (Log.isDebugEnabled(Geonet.SVN_MANAGER))
                Log.debug(Geonet.SVN_MANAGER, "Metadata " + id + " was added");
View Full Code Here

        String logMessage = sessionToLogMessage(context) + " deleting directory for metadata " + id;
        if (Log.isDebugEnabled(Geonet.SVN_MANAGER))
            Log.debug(Geonet.SVN_MANAGER, logMessage);

        ISVNEditor editor = getEditor(logMessage);

        try {
            SvnUtils.deleteDir(editor, id);
            SVNCommitInfo commitInfo = editor.closeEdit();
            if (Log.isDebugEnabled(Geonet.SVN_MANAGER))
                Log.debug(Geonet.SVN_MANAGER, "Directory for metadata " + id + " deleted: " + commitInfo);
        } catch (SVNException svne) {
            editor.abortEdit(); // abort the update on the XML in the repository
            svne.printStackTrace();
            throw svne;
        }
    }
View Full Code Here

     * @return ISVNEditor object for operations on the repository
     * @throws SVNException if something goes wrong
     */
    private ISVNEditor getEditor(String logMessage) throws SVNException {
        SVNRepository repository = getNewRepository();
        ISVNEditor editor = repository.getCommitEditor(logMessage, null /* locks */, false /* keepLocks */, null /* mediator */);
        return editor;
    }
View Full Code Here

        if (commitMessage == null) {
            return SVNCommitInfo.NULL;
        }

        commitMessage = SVNCommitClient.validateCommitMessage(commitMessage);
        ISVNEditor commitEditor = repository.getCommitEditor(commitMessage, null, false, null);
        ISVNCommitPathHandler committer = new CopyCommitPathHandler(srcPath, srcRevNumber, srcKind, dstPath, isMove, isResurrect);
        Collection paths = isMove ? Arrays.asList(new String[] { srcPath, dstPath }) : Collections.singletonList(dstPath);

        SVNCommitInfo result = null;
        try {
            SVNCommitUtil.driveCommitEditor(committer, paths, commitEditor, -1);
            result = commitEditor.closeEdit();
        } catch (SVNException e) {
            try {
                commitEditor.abortEdit();
            } catch (SVNException inner) {
                //
            }
            SVNErrorMessage nestedErr = e.getErrorMessage();
            SVNErrorMessage err = SVNErrorMessage.create(nestedErr.getErrorCode(), "Commit failed (details follow):");
View Full Code Here

            dirArea = adminArea;
        }
       
        Collection tmpFiles = null;
        SVNCommitInfo info = null;
        ISVNEditor commitEditor = null;
        try {
            Map commitables = new TreeMap();
            SVNEntry entry = wcAccess.getEntry(srcPath, false);
            if (entry == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_NOT_FOUND, "''{0}'' is not under version control", srcPath);
                SVNErrorManager.error(err);
                return SVNCommitInfo.NULL;
            }
           
            SVNCommitUtil.harvestCommitables(commitables, dirArea, srcPath, null, entry, dstURL.toString(), entry.getURL(),
                    true, false, false, null, true, false, getCommitParameters());
            items = (SVNCommitItem[]) commitables.values().toArray(new SVNCommitItem[commitables.values().size()]);
            for (int i = 0; i < items.length; i++) {
                items[i].setWCAccess(wcAccess);
            }
           
            commitables = new TreeMap();
            dstURL = SVNURL.parseURIEncoded(SVNCommitUtil.translateCommitables(items, commitables));

            repository = createRepository(dstURL, true);
            SVNCommitMediator mediator = new SVNCommitMediator(commitables);
            tmpFiles = mediator.getTmpFiles();

            commitMessage = SVNCommitClient.validateCommitMessage(commitMessage);
            SVNURL root = repository.getRepositoryRoot(true);
            commitEditor = repository.getCommitEditor(commitMessage, null, false, mediator);
            info = SVNCommitter.commit(tmpFiles, commitables, root.getPath(), commitEditor);
            commitEditor = null;
        } finally {
            if (tmpFiles != null) {
                for (Iterator files = tmpFiles.iterator(); files.hasNext();) {
                    File file = (File) files.next();
                    file.delete();
                }
            }
            if (commitEditor != null && info == null) {
                commitEditor.abortEdit();
            }
            if (wcAccess != null) {
                wcAccess.close();
            }
        }
View Full Code Here

            }

            for (long currentRev = lastMergedRevision + 1; currentRev <= fromLatestRevision; currentRev++) {
                toRepos.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, SVNProperty.toString(currentRev));
                SVNSynchronizeEditor syncEditor = new SVNSynchronizeEditor(toRepos, mySyncHandler, currentRev - 1);
                ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(syncEditor, this, getDebugLog());
                try {
                    fromRepos.replay(0, currentRev, true, cancellableEditor);
                } catch (SVNException e) {
                    try {
                        cancellableEditor.abortEdit();
                    } catch (SVNException abortError) {}
                    throw e;
                }
                cancellableEditor.closeEdit();
                if (syncEditor.getCommitInfo().getNewRevision() != currentRev) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Commit created rev {0,number,integer} but should have created {1,number,integer}", new Long[] {
                            new Long(syncEditor.getCommitInfo().getNewRevision()), new Long(currentRev)
                    });
                    SVNErrorManager.error(err);
View Full Code Here

            }
           
            writeRevisionRecord(dumpStream, fsfs, toRev);
            boolean useDeltasForRevision = useDeltas && (isIncremental || i != start);
            FSRevisionRoot toRoot = fsfs.createRevisionRoot(toRev);
            ISVNEditor dumpEditor = new SVNDumpEditor(fsfs, toRoot, toRev, start, "/", dumpStream, useDeltasForRevision);

            if (i == start && !isIncremental) {
                FSRevisionRoot fromRoot = fsfs.createRevisionRoot(fromRev);
                SVNAdminHelper.deltifyDir(fsfs, fromRoot, "/", "", toRoot, "/", dumpEditor);
            } else {
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.io.ISVNEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.