/** * Committs local changes made to the Working Copy items to the repository. * * <p> * This method is identical to <code>doCommit(commitPacket, keepLocks, false, commitMessage, null)</code>. * * <p> * <code>commitPacket</code> contains commit items ({@link SVNCommitItem}) * which represent local Working Copy items that were changed and are to be committed. * Commit items are gathered into a single {@link SVNCommitPacket} * by invoking {@link #doCollectCommitItems(File[], boolean, boolean, boolean) doCollectCommitItems()}. * * @param commitPacket a single object that contains items to be committed * @param keepLocks if <span class="javakeyword">true</span> and there are local items that * were locked then the commit will left them locked, * otherwise the items will be unlocked after the commit * succeeds * @param commitMessage a string to be a commit log message * @return information on a new revision as the result * of the commit * @throws SVNException * @see SVNCommitItem */ public SVNCommitInfo doCommit(SVNCommitPacket commitPacket, boolean keepLocks, String commitMessage) throws SVNException { return doCommit(commitPacket, keepLocks, false, commitMessage, null); }
/** * Committs a creation of a new directory/directories in the repository. * * @param urls an array containing URL-strings that represent * new repository locations to be created * @param commitMessage a string to be a commit log message * @return information on a new revision as the result * of the commit * @throws SVNException if some of URLs refer to different * repositories */ public SVNCommitInfo doMkDir(SVNURL[] urls, String commitMessage) throws SVNException { return doMkDir(urls, commitMessage, null, false); }
/** * Committs removing specified URL-paths from the repository. * This call is equivalent to <code>doDelete(urls, commitMessage, null)</code>. * * @param urls an array containing URL-strings that represent * repository locations to be removed * @param commitMessage a string to be a commit log message * @return information on a new revision as the result * of the commit * @throws SVNException if one of the following is true: * <ul> * <li>a URL does not exist * <li>probably some of URLs refer to different * repositories * </ul> * @see #doDelete(SVNURL[], String, SVNProperties) */ public SVNCommitInfo doDelete(SVNURL[] urls, String commitMessage) throws SVNException { return doDelete(urls, commitMessage, null); }
protected void initDefaults() { setCommitHander(null); setCommitParameters(null); setCommitHandler(null); }
/** * Returns an instance of the {@link SVNCommitClient} class. * * <p> * If it's the first time this method is being called the object is * created, initialized and then returned. Further calls to this * method will get the same object instantiated at that moment of * the first call. <b>SVNClientManager</b> does not reinstantiate * its <b>SVN</b>*<b>Client</b> objects. * * @return an <b>SVNCommitClient</b> instance */ public SVNCommitClient getCommitClient() { if (myCommitClient == null) { myCommitClient = myOperationFactory != null ? new SVNCommitClient(myOperationFactory) : new SVNCommitClient(this, myOptions); myCommitClient.setEventHandler(myEventHandler); myCommitClient.setDebugLog(getDebugLog()); myCommitClient.setIgnoreExternals(myIsIgnoreExternals); } return myCommitClient; }
SVNCommitClient commitClient = ourClientManager.getCommitClient(); commitClient.setIgnoreExternals(false); SVNNodeKind nodeKind = null; try { nodeKind = repository.checkPath("", -1); } catch (SVNException ex) { Logger.getLogger(Reassignscreen.class.getName()).log(Level.SEVERE, null, ex); } if (nodeKind == SVNNodeKind.NONE) { System.err.println("There is no entry at '" + url + "'."); commitClient.doMkDir(new SVNURL[]{SVNURL.parseURIDecoded(url)}, "New Folder"); }
SVNCommitPacket[] packets = doCollectCommitItems(paths, keepLocks, force, depth, true, changelists); if (packets != null) { SVNCommitInfo[] infos = doCommit(packets, keepLocks, keepChangelist, commitMessage, revisionProperties); if (infos != null && infos.length > 0) { return infos[0];
client.setIgnoreExternals(!getSVNEnvironment().isIncludeExternals()); Collection filesList = new ArrayList(); for (Iterator ts = targets.iterator(); ts.hasNext();) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); client.setCommitHandler(getSVNEnvironment()); boolean keepLocks = getSVNEnvironment().getOptions().isKeepLocks(); SVNCommitInfo info = null; client.setFailOnMultipleRepositories(true); try { info = client.doCommit(files, keepLocks, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().getChangelists(), client.setFailOnMultipleRepositories(false);
try { if(myMessageHandler != null){ client.setCommitHandler(new ISVNCommitHandler(){ public String getCommitMessage(String cmessage, SVNCommitItem[] commitables) { CommitItem[] items = JavaHLObjectFactory.getCommitItems(commitables); packets = client.doCollectCommitItems(files, noUnlock, !recurse, recurse, atomicCommit); commitResults = client.doCommit(packets, noUnlock, message); } catch (SVNException e) { throwException(e);
public long commit(String[] path, String message, boolean recurse, boolean noUnlock) throws ClientException { if(path == null || path.length == 0){ return 0; } SVNCommitClient client = getSVNCommitClient(); File[] files = new File[path.length]; for (int i = 0; i < path.length; i++) { files[i] = new File(path[i]).getAbsoluteFile(); } try { if(myMessageHandler != null){ client.setCommitHandler(new ISVNCommitHandler(){ public String getCommitMessage(String cmessage, SVNCommitItem[] commitables) { CommitItem[] items = JavaHLObjectFactory.getCommitItems(commitables); return myMessageHandler.getLogMessage(items); } }); } return client.doCommit(files, noUnlock, message, !recurse, recurse).getNewRevision(); } catch (SVNException e) { throwException(e); } return -1; }
SVNCommitInfo[] commitResults = null; try { client.setCommitHandler(createCommitMessageHandler(false)); SVNDepth svnDepth = SVNDepth.fromID(depth); boolean recurse = SVNDepth.recurseFromDepth(svnDepth); packets = client.doCollectCommitItems(files, noUnlock, !recurse, svnDepth, atomicCommit, changlelists); if (packets != null) { if (packets.length == 1) { client.setEventHandler(new ISVNEventHandler() { public void checkCancelled() throws SVNCancelException { getEventListener().checkCancelled(); commitResults = client.doCommit(packets, noUnlock, keepChangelist, message, revprops != null ? SVNProperties.wrap(revprops) : null); client.setEventHandler(getEventListener()); client.setCommitHandler(null);
SVNCommitClient client = getSVNEnvironment().getClientManager().getCommitClient(); if (!getSVNEnvironment().isQuiet()) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); client.setCommitHandler(getSVNEnvironment()); SVNURL[] urls = new SVNURL[targets.size()]; for (int i = 0; i < targets.size(); i++) { SVNCommitInfo info = client.doMkDir(urls, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isParents()); if (!getSVNEnvironment().isQuiet()) { getSVNEnvironment().printCommitInfo(info);
SVNCommitClient client = getSVNEnvironment().getClientManager().getCommitClient(); if (!getSVNEnvironment().isQuiet()) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); client.setCommitHandler(getSVNEnvironment()); SVNURL[] urls = new SVNURL[targets.size()]; for (int i = 0; i < targets.size(); i++) { SVNCommitInfo info = client.doDelete(urls, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties()); if (!getSVNEnvironment().isQuiet()) { getSVNEnvironment().printCommitInfo(info);
client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); depth = SVNDepth.INFINITY; client.setCommitHandler(getSVNEnvironment()); SVNCommitInfo info = client.doImport(src.getFile(), url.getURL(), getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties(), !getSVNEnvironment().isNoIgnore(), getSVNEnvironment().isForce(), depth, !getSVNEnvironment().isNoAutoProps());
try { SVNProperties revisionProperties = revprops == null ? null : SVNProperties.wrap(revprops); client.setCommitHandler(createCommitMessageHandler(true, true)); client.doMkDir(svnURLs, message, revisionProperties, makeParents); } catch (SVNException e) { throwException(e); } finally { if (client != null) { client.setCommitHandler(null);
public Void invoke(File ws, VirtualChannel channel) throws IOException, InterruptedException { File workingCopy = new File(ws, location.getLocalDir()).getCanonicalFile(); try { ISVNAuthenticationManager sam = SVNWCUtil.createDefaultAuthenticationManager(); sam.setAuthenticationProvider(authProvider); SVNCommitClient commitClient = new SVNCommitClient(sam, null); buildListener.getLogger().println("[RELEASE] " + commitMessage); debuggingLogger.fine(String.format("Committing working copy: '%s'", workingCopy)); SVNCommitInfo commitInfo = commitClient.doCommit(new File[]{workingCopy}, true, commitMessage, null, null, true, true, SVNDepth.INFINITY); SVNErrorMessage errorMessage = commitInfo.getErrorMessage(); if (errorMessage != null) { throw new IOException("Failed to commit working copy: " + errorMessage.getFullMessage()); } return null; } catch (SVNException e) { debuggingLogger.log(Level.FINE, "Failed to Commit WorkingCopy", e); throw new IOException(e.getMessage()); } } }
client.setCommitHandler(createCommitMessageHandler(true)); client.doDelete(urls, message, revisionProperties); } catch (SVNException e) { throwException(e); } finally { if (client != null) { client.setCommitHandler(null);
public void doImport(String path, String url, String message, int depth, boolean noIgnore, boolean ignoreUnknownNodeTypes, Map revprops) throws ClientException { SVNCommitClient commitClient = getSVNCommitClient(); try { commitClient.setCommitHandler(createCommitMessageHandler(false, true)); SVNProperties revisionProperties = revprops == null ? null : SVNProperties.wrap(revprops); commitClient.doImport(new File(path), SVNURL.parseURIEncoded(url), message, revisionProperties, !noIgnore, ignoreUnknownNodeTypes, JavaHLObjectFactory.getSVNDepth(depth)); } catch (SVNException e) { throwException(e); } finally { if (commitClient != null) { commitClient.setCommitHandler(null); } resetLog(); } }
/** * Committs an addition of a local unversioned file or directory into * the repository. If the destination URL (<code>dstURL</code>) contains any * non-existent parent directories they will be automatically created by the * server. * * @param path a local unversioned file or directory to be imported * into the repository * @param dstURL a URL-string that represents a repository location * where the <code>path</code> will be imported * @param commitMessage a string to be a commit log message * @param recursive this flag is relevant only when the <code>path</code> is * a directory: if <span class="javakeyword">true</span> then the entire directory * tree will be imported including all child directories, otherwise * only items located in the directory itself * @return information on a new revision as the result * of the commit * @throws SVNException if one of the following is true: * <ul> * <li><code>dstURL</code> is invalid * <li>the path denoted by <code>dstURL</code> already * exists * <li><code>path</code> contains a reserved name - <i>'.svn'</i> * </ul> */ public SVNCommitInfo doImport(File path, SVNURL dstURL, String commitMessage, boolean recursive) throws SVNException { return doImport(path, dstURL, commitMessage, true, recursive); }
public void safeRevertTag(String tagUrl, String commitMessageSuffix) { try { log("Reverting subversion tag: " + tagUrl); SVNURL svnUrl = SVNURL.parseURIEncoded(tagUrl); SVNCommitClient commitClient = new SVNCommitClient(createAuthenticationManager(), null); SVNCommitInfo commitInfo = commitClient.doDelete(new SVNURL[]{svnUrl}, COMMENT_PREFIX + commitMessageSuffix); SVNErrorMessage errorMessage = commitInfo.getErrorMessage(); if (errorMessage != null) { log("Failed to revert '" + tagUrl + "': " + errorMessage.getFullMessage()); } } catch (SVNException e) { log("Failed to revert '" + tagUrl + "': " + e.getLocalizedMessage()); } }