public void commitToSvn(SVNClientManager clientManager) throws SVNException { SVNCommitClient commitClient = clientManager.getCommitClient(); File fileToCheckin = new File("LocalDir/SampleFileFolder/SampleFile1"); boolean recursive = true; SVNCommitInfo importInfo = commitClient .doImport( fileToCheckin , SVNURL.parseURIDecoded("<path at which we want to check-in the file>"), "testing svn kit integration", recursive); System.out.println(importInfo.getNewRevision()); }
private CommitInfo getCommitInfo(SVNCommitInfo commitInfo, SVNURL repositoryRoot) throws ParseException { return new CommitInfo(commitInfo.getNewRevision(), SVNDate.formatDate(commitInfo.getDate()), commitInfo.getAuthor(), getErrorMessageString(commitInfo.getErrorMessage()), getUrlString(repositoryRoot)); }
SVNCommitInfo info = ourClientManager.getCommitClient().doCommit(forCommit, false, comment, null, null, false, false, SVNDepth.INFINITY); Log.logDebug(LOGGER, "SVN committed into new revision {0}", info.getNewRevision()); if (info.getNewRevision() < 0) { info = new SVNCommitInfo(Long.parseLong(getFileVersion("")), null, null, null); return Long.toString(info.getNewRevision()); } catch (SVNException ex) { if (Arrays.asList(SVNErrorCode.FS_TXN_OUT_OF_DATE, SVNErrorCode.WC_NOT_UP_TO_DATE, SVNErrorCode.FS_CONFLICT)
public void printCommitInfo(SVNCommitInfo info) { if (info != null && info.getNewRevision() >= 0 && info != SVNCommitInfo.NULL) { getOut().println("Committed revision " + info.getNewRevision() + "."); if (info.getErrorMessage() != null && info.getErrorMessage().isWarning()) { getOut().println("\n" + info.getErrorMessage().getMessage()); } } }
public SVNCommitInfo closeEdit() throws SVNException { ISVNEditor wrappedEditor = getWrappedEditor(); if (!myIsRootOpened) { wrappedEditor.openRoot(myBaseRevision); } myCommitInfo = wrappedEditor.closeEdit(); if (myHandler != null) { SVNLogEntry logEntry = new SVNLogEntry(null, myCommitInfo.getNewRevision(), myCommitInfo.getAuthor(), myCommitInfo.getDate(), null); myHandler.handleLogEntry(logEntry); } return myCommitInfo; }
/** * @deprecated use {@link #getErrorMessage() } instead */ public SVNException getError() { if (myErrorMessage != null) { return new SVNException(getErrorMessage()); } return null; }
public SVNCommitInfo closeEdit() throws SVNException { if (!myIsRootOpen) { super.closeEdit(); } return new SVNCommitInfo(getTargetRevision(), null, null); }
public SVNCommitInfo closeEdit() throws SVNException { ISVNEditor wrappedEditor = getWrappedEditor(); if (!myIsRootOpened) { wrappedEditor.openRoot(myBaseRevision); } myCommitInfo = wrappedEditor.closeEdit(); if (myHandler != null) { SVNLogEntry logEntry = new SVNLogEntry(null, myCommitInfo.getNewRevision(), myCommitInfo.getAuthor(), myCommitInfo.getDate(), null); myHandler.handleLogEntry(logEntry); } return myCommitInfo; }
public void printCommitInfo(SVNCommitInfo info) { if (info != null && info.getNewRevision() >= 0 && info != SVNCommitInfo.NULL) { getOut().println("Committed revision " + info.getNewRevision() + "."); if (info.getErrorMessage() != null && info.getErrorMessage().isWarning()) { getOut().println("\n" + info.getErrorMessage().getMessage()); } } }
/** * @return exception occurred * @deprecated use {@link #getErrorMessage() } instead */ public SVNException getError() { if (myErrorMessage != null) { return new SVNException(getErrorMessage()); } return null; }
public SVNCommitInfo closeEdit() throws SVNException { if (myIsRootOpen) { cleanup(); } else { super.closeEdit(); } return new SVNCommitInfo(myTargetRevision, null, null); }
final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); try { final SvnRemoteDelete remoteDelete = svnOperationFactory.createRemoteDelete(); remoteDelete.setSingleTarget(SvnTarget.fromURL(fileUrl)); remoteDelete.setCommitMessage("Delete a file from the repository"); final SVNCommitInfo commitInfo = remoteDelete.run(); if (commitInfo != null) { final long newRevision = commitInfo.getNewRevision(); System.out.println("Removed a file, revision " + newRevision + " created"); } } finally { svnOperationFactory.dispose(); }
public SVNCommitInfo closeEdit() throws SVNException { ISVNEditor wrappedEditor = getWrappedEditor(); if (!myIsRootOpened) { wrappedEditor.openRoot(myBaseRevision); } myCommitInfo = wrappedEditor.closeEdit(); if (myHandler != null) { SVNLogEntry logEntry = new SVNLogEntry(null, myCommitInfo.getNewRevision(), myCommitInfo.getAuthor(), myCommitInfo.getDate(), null); myHandler.handleLogEntry(logEntry); } return myCommitInfo; }
commitEditor = null; if (info.getErrorMessage() == null || info.getErrorMessage().getErrorCode() == SVNErrorCode.REPOS_POST_COMMIT_HOOK_FAILED) { postProcessCommitItem(queue, item, getOperation().isKeepChangelists(), getOperation().isKeepLocks(), sha1Checksums.get(item.getPath())); processCommittedQueue(queue, info.getNewRevision(), info.getDate(), info.getAuthor()); deleteDeleteFiles(committer, getOperation().getCommitParameters()); } catch (SVNException e) { handleEvent(SVNEventFactory.createSVNEvent(null, SVNNodeKind.NONE, null, info.getNewRevision(), SVNEventAction.COMMIT_COMPLETED, SVNEventAction.COMMIT_COMPLETED, null, null, -1, -1)); } catch (SVNException e) { info = new SVNCommitInfo(-1, null, null, err); handleEvent(SVNEventFactory.createErrorEvent(err, SVNEventAction.COMMIT_COMPLETED), ISVNEventHandler.UNKNOWN); if (packet.getRepositoryRoots().size() == 1) {
@Override public String call() throws DebianizingException { SvnClientManager clientManager = SubversionSCM.createClientManager(provider); try { SVNCommitPacket changeset = clientManager.getCommitClient().doCollectCommitItems(new File[] {new File(path)}, false, true, SVNDepth.INFINITY, null); if (changeset != SVNCommitPacket.EMPTY) { SVNCommitInfo commitInfo = clientManager.getCommitClient().doCommit(changeset, false, commitMessage); if (commitInfo.getErrorMessage() != null) { throw new DebianizingException(MessageFormat.format("Error while commiting <{0}>: {1}", path, commitInfo.getErrorMessage().toString())); } else { return Long.toString(commitInfo.getNewRevision()); } } else { throw new DebianizingException("There was nothing to commit."); } } catch (SVNException e) { throw new DebianizingException("SVNException: " + e.getMessage(), e); } finally { clientManager.dispose(); } } }
dispatchEvent(SVNEventFactory.createCommitCompletedEvent(null, info.getNewRevision()), ISVNEventHandler.UNKNOWN); } catch (SVNException e) { if (e instanceof SVNCancelException) { infos.add(new SVNCommitInfo(-1, null, null, err)); dispatchEvent(new SVNEvent(err), ISVNEventHandler.UNKNOWN); continue;
/** * @return exception occurred * @deprecated use {@link #getErrorMessage() } instead */ public SVNException getError() { if (myErrorMessage != null) { return new SVNException(getErrorMessage()); } return null; }
public SVNCommitInfo closeEdit() throws SVNException { if (myIsRootOpen) { cleanup(); } else { super.closeEdit(); } return new SVNCommitInfo(getTargetRevision(), null, null); }
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; }
public SVNCommitInfo closeEdit() throws SVNException { ISVNEditor wrappedEditor = getWrappedEditor(); if (!myIsRootOpened) { wrappedEditor.openRoot(myBaseRevision); } myCommitInfo = wrappedEditor.closeEdit(); if (myHandler != null) { SVNLogEntry logEntry = new SVNLogEntry(null, myCommitInfo.getNewRevision(), myCommitInfo.getAuthor(), myCommitInfo.getDate(), null); myHandler.handleLogEntry(logEntry); } return myCommitInfo; }