当前位置: 首页>>代码示例>>Java>>正文


Java SVNDeltaGenerator类代码示例

本文整理汇总了Java中org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator的典型用法代码示例。如果您正苦于以下问题:Java SVNDeltaGenerator类的具体用法?Java SVNDeltaGenerator怎么用?Java SVNDeltaGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SVNDeltaGenerator类属于org.tmatesoft.svn.core.io.diff包,在下文中一共展示了SVNDeltaGenerator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFile

import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; //导入依赖的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();

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:38,代码来源:SVNCommit.java

示例2: modifyFile

import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; //导入依赖的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();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:33,代码来源:SVNCommit.java

示例3: putFile

import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; //导入依赖的package包/类
/**
 * Puts a file into Subversion, does update or add depending on whether file already exists or not. Folder containing
 * file *must* already exist.
 * 
 * @param editor An initialised commit editor.
 * @param data File data as a byte array.
 * @param destinationFolder Destination folder in svn.
 * @param fileName File name.
 * @param overwrite Whether existing file should be overwritten or not.
 * @return true if File was updated or added, false if it was ignored (i.e. it already exists and overwrite was
 *         false).
 * @throws SVNException If an error occurs putting the file into Subversion.
 */
public boolean putFile(ISVNEditor editor, byte[] data, String destinationFolder, String fileName, boolean overwrite)
  throws SVNException {
  String filePath = destinationFolder + "/" + fileName;
  if (fileExists(filePath, -1)) { // updating existing file
    if (overwrite) {
      Message.debug("Updating file " + filePath);
      editor.openFile(filePath, -1);
    } else {
      Message.info("Overwrite set to false, ignoring " + filePath);
      return false;
    }
  } else { // creating new file
    Message.debug("Adding file " + filePath);
    editor.addFile(filePath, null, -1);
  }
  editor.applyTextDelta(filePath, null);
  SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
  String checksum = deltaGenerator.sendDelta(filePath, new ByteArrayInputStream(data), editor, true);
  editor.closeFile(filePath, checksum);
  return true;
}
 
开发者ID:massdosage,项目名称:ivysvn,代码行数:35,代码来源:SvnDao.java

示例4: create

import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; //导入依赖的package包/类
public void create(final ISVNEditor commitEditor, final String path, final InputStream content, Map<String, String> attributes) throws SVNException, IOException {
  final BufferedInputStream bis = new BufferedInputStream(content);
  final String autoDetectedMimeType = detectMimeType(bis);

  commitEditor.addFile(path, null, -1);
  commitEditor.applyTextDelta(path, null);
  SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
  String checksum = deltaGenerator.sendDelta(path, bis, commitEditor, true);
  final Map<String, String> autoProperties = _autoPropertiesApplier.apply(path);
  final Map<String, String> allProperties = new LinkedHashMap<String, String>();
  allProperties.putAll(autoProperties);
  allProperties.putAll(attributes);
  setProperties(commitEditor, path, allProperties);
  if (!allProperties.containsKey(SVNProperty.MIME_TYPE) && autoDetectedMimeType != null) {
    commitEditor.changeFileProperty(path, SVNProperty.MIME_TYPE, SVNPropertyValue.create(autoDetectedMimeType));
  }
  commitEditor.closeFile(path, checksum);
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:19,代码来源:RepositoryBasicSVNOperations.java

示例5: commit

import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; //导入依赖的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());
    }
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:63,代码来源:MCRVersionedMetadata.java

示例6: write

import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; //导入依赖的package包/类
public SVNCommitInfo write(final String path, final String commitmessage, final ByteArrayInputStream is) throws SVNException, IOException {

        final File file = new File(Application.getTempResource("svnwrite_" + System.currentTimeMillis()), path);
        downloadFile(svnurl + (svnurl.toString().endsWith("/") ? "" : "/") + path, file, SVNRevision.HEAD);

        final SVNDeltaGenerator generator = new SVNDeltaGenerator();

        final ISVNEditor commitEditor = getRepository().getCommitEditor(commitmessage, null);
        try {
            commitEditor.openRoot(-1);
            commitEditor.openFile(path, -1);
            commitEditor.applyTextDelta(path, null);
            final String checksum = generator.sendDelta(path, is, commitEditor, true);
            commitEditor.closeFile(path, checksum);
            commitEditor.closeDir();
            final SVNCommitInfo info = commitEditor.closeEdit();
            return info;
        } finally {
            if (commitEditor != null) {
                commitEditor.abortEdit();
            }

            Files.deleteRecursiv(file.getParentFile());

        }

    }
 
开发者ID:friedlwo,项目名称:AppWoksUtils,代码行数:28,代码来源:Subversion.java

示例7: edit

import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; //导入依赖的package包/类
public void edit(final ISVNEditor commitEditor, final String path, final long baseRevision, final InputStream content, Map<String, String> attributes)  throws SVNException {
  commitEditor.openFile(path, baseRevision);
  commitEditor.applyTextDelta(path, null);
  SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
  // We don't keep the base around so we can't provide it here.
  String checksum = deltaGenerator.sendDelta(path, content, commitEditor, true);
  setProperties(commitEditor, path, attributes);
  commitEditor.closeFile(path, checksum);
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:10,代码来源:RepositoryBasicSVNOperations.java

示例8: sendDeltaAndClose

import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; //导入依赖的package包/类
public static void sendDeltaAndClose(@NotNull ISVNEditor editor, @NotNull String filePath, @Nullable byte[] oldData, @Nullable byte[] newData) throws SVNException, IOException {
  try (
      ByteArrayInputStream oldStream = new ByteArrayInputStream(oldData == null ? emptyBytes : oldData);
      ByteArrayInputStream newStream = new ByteArrayInputStream(newData == null ? emptyBytes : newData)
  ) {
    editor.applyTextDelta(filePath, null);
    SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
    String checksum = deltaGenerator.sendDelta(filePath, oldStream, 0, newStream, editor, true);
    editor.closeFile(filePath, checksum);
  }
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:12,代码来源:SvnTestHelper.java


注:本文中的org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。