本文整理汇总了Java中org.tmatesoft.svn.core.SVNCommitInfo类的典型用法代码示例。如果您正苦于以下问题:Java SVNCommitInfo类的具体用法?Java SVNCommitInfo怎么用?Java SVNCommitInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SVNCommitInfo类属于org.tmatesoft.svn.core包,在下文中一共展示了SVNCommitInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFile
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
/**
* @작성자 : KYJ
* @작성일 : 2016. 7. 12.
* @param editor
* @param dirPath
* remote server relative path.
* @param fileName
* only SimpleFileName
* @param dataStream
* @return
* @throws SVNException
*/
private static SVNCommitInfo addFile(ISVNEditor editor, String dirPath, String fileName, InputStream dataStream) throws SVNException {
//Open Root
editor.openRoot(-1);
//Open Dir
editor.openDir(dirPath, -1);
//Add file
editor.addFile(fileName, null, -1);
editor.applyTextDelta(fileName, null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
String checksum = deltaGenerator.sendDelta(fileName, dataStream, editor, true);
//Close File
editor.closeFile(fileName, checksum);
//Closes dirPath.
editor.closeDir();
//Closes the root directory.
editor.closeDir();
return editor.closeEdit();
}
示例2: doImport
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
@Override
public long doImport(@NotNull File path,
@NotNull SVNURL url,
@Nullable Depth depth,
@NotNull String message,
boolean noIgnore,
@Nullable CommitEventHandler handler,
@Nullable ISVNCommitHandler commitHandler) throws VcsException {
SVNCommitClient client = myVcs.getSvnKitManager().createCommitClient();
client.setEventHandler(toEventHandler(handler));
client.setCommitHandler(commitHandler);
try {
SVNCommitInfo info = client.doImport(path, url, message, null, !noIgnore, false, toDepth(depth));
return info.getNewRevision();
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例3: delete
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
@Override
public void delete(int id) throws IOException {
String commitMsg = "Deleted metadata object " + getID() + "_" + id + " in store";
// Commit to SVN
SVNCommitInfo info;
try {
SVNRepository repository = getRepository();
ISVNEditor editor = repository.getCommitEditor(commitMsg, null);
editor.openRoot(-1);
editor.deleteEntry("/" + getSlotPath(id), -1);
editor.closeDir();
info = editor.closeEdit();
LOGGER.info("SVN commit of delete finished, new revision {}", info.getNewRevision());
} catch (SVNException e) {
LOGGER.error("Error while deleting {} in SVN ", id, e);
} finally {
super.delete(id);
}
}
示例4: commitClient
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
/**
*
* FileSystem Base Commit Operation.
*
* @작성자 : KYJ
* @작성일 : 2016. 7. 13.
* @param paths
* @param commitMessage
* @return
* @throws SVNException
*/
public SVNCommitInfo commitClient(File[] paths, String commitMessage) throws SVNException {
/*
* Parameters:
* paths :: paths to commit
* keepLocks :: whether to unlock or not files in the repository
* commitMessage :: commit log message
* revisionProperties :: custom revision properties
* changelists :: changelist names array
* keepChangelist :: whether to remove changelists or not
* force :: true to force a non-recursive commit; if depth is SVNDepth.INFINITY the force flag is ignored
* depth :: tree depth to processReturns: information about the new committed revision
*/
return getSvnManager().getCommitClient().doCommit(paths, false, commitMessage, null, null, false, true, SVNDepth.INFINITY);
}
示例5: modifyFile
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
/**
* 수정.
* @작성자 : KYJ
* @작성일 : 2016. 7. 12.
* @param editor
* @param dirPath
* remote server relative path.
* @param fileName
* only SimpleFileName
* @param oldData
* @param newData
* @return
* @throws SVNException
*/
private static SVNCommitInfo modifyFile(ISVNEditor editor, String dirPath, String fileName, InputStream oldData, InputStream newData)
throws SVNException {
editor.openRoot(-1);
editor.openDir(dirPath, -1);
editor.openFile(fileName, -1);
editor.applyTextDelta(fileName, null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
String checksum = deltaGenerator.sendDelta(fileName, oldData, 0, newData, editor, true);
//Closes filePath.
editor.closeFile(fileName, checksum);
// Closes dirPath.
editor.closeDir();
//Closes the root directory.
editor.closeDir();
return editor.closeEdit();
}
示例6: commitTest
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
/**
* SVN Commit Test.
*
* @작성자 : KYJ
* @작성일 : 2016. 7. 12.
* @throws SVNException
* @throws IOException
*/
@Test
public void commitTest() throws SVNException, IOException {
File[] commitTestFiles = getCommitTestFiles();
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(commitTestFiles[0]);
// thirdPartManager.commit_new("/sql", commitTestFiles[0].getName(), inputStream, "test commit.");
// commitTestFiles = new File[] { new File("C:\\logs\\test\\deprecated_pass-batch-core\\sql\\text.txt") };
SVNCommitInfo commit_modify = localServerManager.commit_modify("sql", "text.txt", inputStream, "test commit.");
System.out.println(commit_modify.getAuthor());
System.out.println(commit_modify.getNewRevision());
} finally {
if (inputStream != null)
inputStream.close();
}
}
示例7: commitReverseTest
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
@Test
public void commitReverseTest() throws SVNException, IOException {
File[] commitTestFiles = getCommitTestFiles();
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(commitTestFiles[0]);
// thirdPartManager.commit_new("/sql", commitTestFiles[0].getName(), inputStream, "test commit.");
// commitTestFiles = new File[] { new File("C:\\logs\\test\\deprecated_pass-batch-core\\sql\\text.txt") };
SVNCommitInfo commit_modify = localServerManager.commit_modify_reverse("sql", "text.txt", 42);
System.out.println(commit_modify.getAuthor());
System.out.println(commit_modify.getNewRevision());
} finally {
if (inputStream != null)
inputStream.close();
}
}
示例8: copy
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
public static SVNCommitInfo copy( SVNClientManager clientManager, SVNURL srcURL, SVNURL dstURL, boolean isMove,
String commitMessage, String revision )
throws SVNException
{
SVNRevision svnRevision = null;
if ( StringUtils.isEmpty( revision ) )
{
svnRevision = SVNRevision.HEAD;
}
else
{
svnRevision = SVNRevision.create( Long.parseLong( revision ) );
}
/*
* SVNRevision.HEAD means the latest revision.
* Returns SVNCommitInfo containing information on the new revision committed
* (revision number, etc.)
*/
SVNCopySource[] svnCopySources = new SVNCopySource[1];
svnCopySources[0] = new SVNCopySource( svnRevision, svnRevision, srcURL );
return clientManager.getCopyClient().doCopy( svnCopySources, dstURL, false, true, true, commitMessage,
new SVNProperties() );
//return clientManager.getCopyClient().doCopy( srcURL, svnRevision, dstURL, isMove, commitMessage, new SVNProperties() );
}
示例9: createRemoteFolder
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
private static Pair<SVNRevision, SVNURL> createRemoteFolder(final SvnVcs vcs,
final SVNURL parent,
final String folderName,
String commitText) throws SVNException {
SVNURL url = parent.appendPath(folderName, false);
final String urlText = url.toString();
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.checkCanceled();
indicator.setText(SvnBundle.message("share.directory.create.dir.progress.text", urlText));
}
final SVNCommitInfo info =
vcs.createCommitClient().doMkDir(new SVNURL[]{url}, SvnBundle.message("share.directory.commit.message", folderName,
ApplicationNamesInfo.getInstance().getFullProductName(), commitText));
return new Pair<SVNRevision, SVNURL>(SVNRevision.create(info.getNewRevision()), url);
}
示例10: doImport
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
/**
* 导入整个路径至SVN根目录
*
* @param path
* @return
*/
public Long doImport(String path) {
File impDir = new File(path);
if (!impDir.exists()) {
logger.error("import path not exists");
}
try {
SVNCommitInfo commitInfo = clientManager.getCommitClient()
.doImport(impDir, repositoryURL, "import operation!", null,
false, false, SVNDepth.INFINITY);
logger.info(commitInfo.toString());
return commitInfo.getNewRevision();
} catch (SVNException e) {
logger.error("import error");
return null;
}
}
示例11: doCommit
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
/**
* 提交文件
*
* @param file
* @return
*/
public Long doCommit(File... files) {
SVNCommitInfo commitInfo = null;
try {
commitInfo = clientManager.getCommitClient().doCommit(files, true,
"", null, null, true, false, SVNDepth.INFINITY);
logger.info("commit succcess, detail is " + commitInfo.toString());
return commitInfo.getNewRevision();
} catch (SVNException e) {
logger.error("commit error");
return null;
}
}
示例12: commit
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
void commit(String mode) throws IOException {
// Commit to SVN
SVNCommitInfo info;
try {
SVNRepository repository = getStore().getRepository();
// Check which paths already exist in SVN
String[] paths = store.getSlotPaths(id);
int existing = paths.length - 1;
for (; existing >= 0; existing--) {
if (!repository.checkPath(paths[existing], -1).equals(SVNNodeKind.NONE)) {
break;
}
}
existing += 1;
// Start commit editor
String commitMsg = mode + "d metadata object " + store.getID() + "_" + id + " in store";
ISVNEditor editor = repository.getCommitEditor(commitMsg, null);
editor.openRoot(-1);
// Create directories in SVN that do not exist yet
for (int i = existing; i < paths.length - 1; i++) {
LOGGER.debug("SVN create directory {}", paths[i]);
editor.addDir(paths[i], null, -1);
editor.closeDir();
}
// Commit file changes
String filePath = paths[paths.length - 1];
if (existing < paths.length) {
editor.addFile(filePath, null, -1);
} else {
editor.openFile(filePath, -1);
}
editor.applyTextDelta(filePath, null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
InputStream in = fo.getContent().getInputStream();
String checksum = deltaGenerator.sendDelta(filePath, in, editor, true);
in.close();
if (store.shouldForceXML()) {
editor.changeFileProperty(filePath, SVNProperty.MIME_TYPE, SVNPropertyValue.create("text/xml"));
}
editor.closeFile(filePath, checksum);
editor.closeDir(); // root
info = editor.closeEdit();
} catch (SVNException e) {
throw new IOException(e);
}
revision = () -> Optional.of(info.getNewRevision());
LOGGER.info("SVN commit of {} finished, new revision {}", mode, getRevision());
if (MCRVersioningMetadataStore.shouldSyncLastModifiedOnSVNCommit()) {
setLastModified(info.getDate());
}
}
示例13: addFileTest
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
@Test
public void addFileTest() throws Exception {
if (!localServerManager.isExistsPath("test")) {
System.out.println("존재하지않음.. 새로 생성함.");
}
String newFile = "test_" + System.currentTimeMillis() + ".txt";
String content = "New File Add Test FileName ::: " + newFile;
SVNCommitInfo commit_new = localServerManager.commit_new("test", newFile, content.getBytes(), content);
System.out.printf("New File Revision : %d author : %s \n", commit_new.getNewRevision(), commit_new.getAuthor());
}
示例14: convert
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
@NotNull
private static CommitInfo[] convert(@NotNull SVNCommitInfo[] infos) {
return ContainerUtil.map(infos, new Function<SVNCommitInfo, CommitInfo>() {
@Override
public CommitInfo fun(SVNCommitInfo info) {
return new CommitInfo.Builder(info.getNewRevision(), info.getDate(), info.getAuthor())
.setError(info.getErrorMessage()).build();
}
}, new CommitInfo[0]);
}
示例15: delete
import org.tmatesoft.svn.core.SVNCommitInfo; //导入依赖的package包/类
@Override
public long delete(@NotNull SVNURL url, @NotNull String message) throws VcsException {
try {
SVNCommitInfo commitInfo = myVcs.getSvnKitManager().createCommitClient().doDelete(new SVNURL[]{url}, message);
return commitInfo.getNewRevision();
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}