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


Java SVNPropertyValue类代码示例

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


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

示例1: create

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的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

示例2: execute

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
public void execute(final VirtualFile[] file, final IgnoreInfoGetter getter) throws VcsException {
  final Map<VirtualFile, Set<String>> foldersInfo = getter.getInfo(myUseCommonExtension);
  for (final Map.Entry<VirtualFile, Set<String>> entry : foldersInfo.entrySet()) {
    if (stopIteration()) {
      break;
    }
    final File dir = new File(entry.getKey().getPath());
    try {
      final SVNPropertyValue value;
      if (myCanUseCachedProperty) {
        value = myVcs.getPropertyWithCaching(entry.getKey(), SvnPropertyKeys.SVN_IGNORE);
      } else {
        final SVNPropertyData data =
          myVcs.createWCClient().doGetProperty(dir, SvnPropertyKeys.SVN_IGNORE, SVNRevision.UNDEFINED, SVNRevision.WORKING);
        value = data == null ? null : data.getValue();
      }
      processFolder(entry.getKey(), dir, entry.getValue(), value);
    }
    catch (SVNException e) {
      onSVNException(e);
    }
  }
  onAfterProcessing(file);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:SvnPropertyService.java

示例3: getIgnoreStringsUnder

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
@Nullable
public static Set<String> getIgnoreStringsUnder(final SvnVcs vcs, final VirtualFile dir) {
  try {
    final SVNPropertyData data = vcs.createWCClient().doGetProperty(new File(dir.getPath()), SvnPropertyKeys.SVN_IGNORE, SVNRevision.WORKING, SVNRevision.WORKING);
    final SVNPropertyValue value = (data == null) ? null : data.getValue();
    if (value != null) {
      final Set<String> ignorePatterns = new HashSet<String>();
      final String propAsString = SVNPropertyValue.getPropertyAsString(value);
      final StringTokenizer st = new StringTokenizer(propAsString, "\r\n ");
      while (st.hasMoreElements()) {
        final String ignorePattern = (String) st.nextElement();
        ignorePatterns.add(ignorePattern);
      }
      return ignorePatterns;
    }
  }
  catch (SVNException e) {
    LOG.info(e);
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:SvnPropertyService.java

示例4: processFolder

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
protected void processFolder(final VirtualFile folder, final File folderDir, final Set<String> data, final SVNPropertyValue propertyValue)
    throws SVNException {
  if (propertyValue == null) {
    myFilesOk = false;
    myExtensionOk = false;
    return;
  }
  final Set<String> ignorePatterns = new HashSet<String>();
  final StringTokenizer st = new StringTokenizer(SVNPropertyValue.getPropertyAsString(propertyValue), "\r\n ");
  while (st.hasMoreElements()) {
    final String ignorePattern = (String)st.nextElement();
    ignorePatterns.add(ignorePattern);
  }

  myExtensionOk &= ignorePatterns.contains(myExtensionPattern);
  for (final String fileName : data) {
    if (!ignorePatterns.contains(fileName)) {
      myFilesOk = false;
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:SvnPropertyService.java

示例5: addToExternalProperty

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
public static boolean addToExternalProperty(SvnVcs vcs, File ioFile, String target, String url) throws SVNException {
  final SVNWCClient wcClient = vcs.createWCClient();
  final SVNPropertyData propertyData =
    wcClient.doGetProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, SVNRevision.UNDEFINED, SVNRevision.UNDEFINED);
  String newValue;
  if (propertyData != null && propertyData.getValue() != null && ! StringUtil.isEmptyOrSpaces(propertyData.getValue().getString())) {
    final SVNExternal[] externals = SVNExternal.parseExternals("Create External", propertyData.getValue().getString());
    for (SVNExternal external : externals) {
      if (Comparing.equal(external.getPath(), target)) {
        AbstractVcsHelper
          .getInstance(vcs.getProject()).showError(new VcsException("Selected destination conflicts with existing: " + external.toString()), "Create External");
        return true;
      }
    }
    final String string = createExternalDefinitionString(url, target);
    newValue = propertyData.getValue().getString() + "\n" + string;
  } else {
    newValue = createExternalDefinitionString(url, target);
  }
  wcClient.doSetProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, SVNPropertyValue.create(newValue), false, SVNDepth.EMPTY, null, null);
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:CreateExternalAction.java

示例6: updatePropertyValue

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
private void updatePropertyValue(String name) {
  if (myFiles.length == 0 || myFiles.length > 1) {
    return;
  }
  File file = myFiles[0];
  SVNPropertyData property;
  try {
    SVNWCClient client = myVCS.createWCClient();
    property = client.doGetProperty(file, name, SVNRevision.WORKING, SVNRevision.WORKING);
  }
  catch (SVNException e) {
    property = null;
  }
  if (property != null) {
    myValueText.setText(SVNPropertyValue.getPropertyAsString(property.getValue()));
    myValueText.selectAll();
  }
  else {
    myValueText.setText("");
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:SetPropertyDialog.java

示例7: mergeinfoChanged

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
private boolean mergeinfoChanged(final File file) {
  final SVNWCClient client = myVcs.createWCClient();
  try {
    final SVNPropertyData current = client.doGetProperty(file, "svn:mergeinfo", SVNRevision.UNDEFINED, SVNRevision.WORKING);
    final SVNPropertyData base = client.doGetProperty(file, "svn:mergeinfo", SVNRevision.UNDEFINED, SVNRevision.BASE);
    if (current != null) {
      if (base == null) {
        return true;
      } else {
        final SVNPropertyValue currentValue = current.getValue();
        final SVNPropertyValue baseValue = base.getValue();
        return ! Comparing.equal(currentValue, baseValue);
      }
    }
  }
  catch (SVNException e) {
    //
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:GatheringChangelistBuilder.java

示例8: run

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
@Override
public void run(@NotNull ProgressIndicator indicator) {
  final SVNWCClient client = myVcs.createWCClient();
  final String url = myLocation.getURL();
  final SVNURL root;
  try {
    root = SvnUtil.getRepositoryRoot(myVcs, SVNURL.parseURIEncoded(url), true);
    if (root == null) {
      myException = new VcsException("Can not determine repository root for URL: " + url);
      return;
    }
    client.doSetRevisionProperty(root, SVNRevision.create(myNumber), "svn:log",
                                 SVNPropertyValue.create(myNewMessage), false, null);
  }
  catch (SVNException e) {
    myException = new VcsException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:SvnEditCommitMessageAction.java

示例9: commitDirWithProperties

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
/**
 * Check commit .gitattributes.
 *
 * @throws Exception
 */
@Test
public void commitDirWithProperties() throws Exception {
  try (SvnTestServer server = SvnTestServer.createEmpty()) {
    final SVNRepository repo = server.openSvnRepository();

    final long latestRevision = repo.getLatestRevision();
    final ISVNEditor editor = repo.getCommitEditor("Create directory: /foo", null, false, null);
    editor.openRoot(-1);
    editor.addDir("/foo", null, latestRevision);
    editor.changeDirProperty(SVNProperty.INHERITABLE_AUTO_PROPS, SVNPropertyValue.create("*.txt = svn:eol-style=native\n"));
    // Empty file.
    final String filePath = "/foo/.gitattributes";
    editor.addFile(filePath, null, -1);
    editor.changeFileProperty(filePath, SVNProperty.EOL_STYLE, SVNPropertyValue.create(SVNProperty.EOL_STYLE_NATIVE));
    sendDeltaAndClose(editor, filePath, null, "*.txt\t\t\ttext eol=native\n");
    // Close dir
    editor.closeDir();
    editor.closeDir();
    editor.closeEdit();
  }
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:27,代码来源:SvnFilePropertyTest.java

示例10: commitRootWithProperties

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
/**
 * Check commit .gitattributes.
 *
 * @throws Exception
 */
@Test
public void commitRootWithProperties() throws Exception {
  try (SvnTestServer server = SvnTestServer.createEmpty()) {
    final SVNRepository repo = server.openSvnRepository();

    createFile(repo, "/.gitattributes", "", propsEolNative);
    {
      long latestRevision = repo.getLatestRevision();
      final ISVNEditor editor = repo.getCommitEditor("Modify .gitattributes", null, false, null);
      editor.openRoot(latestRevision);
      editor.changeDirProperty(SVNProperty.INHERITABLE_AUTO_PROPS, SVNPropertyValue.create("*.txt = svn:eol-style=native\n"));
      // Empty file.
      final String filePath = "/.gitattributes";
      editor.openFile(filePath, latestRevision);
      sendDeltaAndClose(editor, filePath, "", "*.txt\t\t\ttext eol=native\n");
      // Close dir
      editor.closeDir();
      editor.closeEdit();
    }
  }
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:27,代码来源:SvnFilePropertyTest.java

示例11: commit

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的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

示例12: testOneFileCreatedDeep

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
@Test
public void testOneFileCreatedDeep() throws Exception {
  final VirtualFile versionedParent = createDirInCommand(myWorkingCopyDir, "versionedParent");
  final String name = "ign123";
  myVcs.getSvnKitManager().createWCClient().doSetProperty(new File(versionedParent.getPath()), SvnPropertyKeys.SVN_IGNORE,
                                       SVNPropertyValue.create(name + "\n"), true, SVNDepth.EMPTY, null, null);
  checkin();
  update();

  final List<VirtualFile> ignored = new ArrayList<VirtualFile>();
  final VirtualFile ignChild = createDirInCommand(versionedParent, name);
  ignored.add(ignChild);
  VirtualFile current = ignChild;
  for (int i = 0; i < 10; i++) {
    current = createDirInCommand(current, "dir" + i);
    ignored.add(current);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    Assert.assertTrue(clManager.getDefaultChangeList().getChanges().isEmpty());
  }
  testOneFile(current, "file.txt");

  final Random rnd = new Random(17);
  for (int i = 0; i < 20; i++) {
    final int idx = rnd.nextInt(ignored.size());
    testOneFile(ignored.get(idx), "file" + i + ".txt");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:SvnIgnoreTest.java

示例13: testManyDeep

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
@Test
public void testManyDeep() throws Exception {
  final VirtualFile versionedParent = createDirInCommand(myWorkingCopyDir, "versionedParent");
  final String name = "ign123";
  final String name2 = "ign321";
  myVcs.getSvnKitManager().createWCClient().doSetProperty(new File(versionedParent.getPath()), SvnPropertyKeys.SVN_IGNORE,
                                       SVNPropertyValue.create(name + "\n" + name2 + "\n"), true, SVNDepth.EMPTY, null, null);
  checkin();
  update();

  final List<VirtualFile> ignored = new ArrayList<VirtualFile>();
  final VirtualFile ignChild = createDirInCommand(versionedParent, name);
  final VirtualFile ignChild2 = createDirInCommand(versionedParent, name2);
  ignored.add(ignChild);
  ignored.add(ignChild2);
  VirtualFile current = ignChild;
  for (int i = 0; i < 10; i++) {
    current = createDirInCommand(current, "dir" + i);
    ignored.add(current);
  }
  current = ignChild2;
  for (int i = 0; i < 10; i++) {
    current = createDirInCommand(current, "dir" + i);
    ignored.add(current);
  }

  final Random rnd = new Random(17);
  final List<VirtualFile> vf = new ArrayList<VirtualFile>();
  for (int i = 0; i < 200; i++) {
    final int idx = rnd.nextInt(ignored.size());
    vf.add(createFileInCommand(ignored.get(idx), "file" + i + ".txt", "***"));
  }
  for (int i = 0; i < 50; i++) {
    final VirtualFile virtualFile = vf.get(rnd.nextInt(vf.size()));
    testImpl(virtualFile);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:SvnIgnoreTest.java

示例14: setProperty

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
private void setProperty(final File file, final String name, final String value) throws SVNException {
  final SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
  client.doSetProperty(file, new ISVNPropertyValueProvider() {
    @Override
    public SVNProperties providePropertyValues(File path, SVNProperties properties) throws SVNException {
      final SVNProperties result = new SVNProperties();
      result.put(name, SVNPropertyValue.create(value));
      return result;
    }
  }, true, SVNDepth.EMPTY, null, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SvnRollbackTest.java

示例15: changeProperties

import org.tmatesoft.svn.core.SVNPropertyValue; //导入依赖的package包/类
private void changeProperties(EditorEntry entry, String name, SVNPropertyValue value) throws SVNException {
    //String quotedName = SVNEncodingUtil.xmlEncodeCDATA(name, true);
    if (getUpdateRequest().isSendAll()) {
        if (value != null) {
            writePropertyTag("set-prop", name, value);
        } else {
            writeEntryTag("remove-prop", name);
        }
    } else if (value != null) {
        if (SVNProperty.isEntryProperty(name)) {
            if (SVNProperty.COMMITTED_REVISION.equals(name)) {
                entry.setCommitedRevision(value.getString());
            } else if (SVNProperty.COMMITTED_DATE.equals(name)) {
                entry.setCommitedDate(value.getString());
            } else if (SVNProperty.LAST_AUTHOR.equals(name)) {
                entry.setLastAuthor(value.getString());
            } else if (SVNProperty.LOCK_TOKEN.equals(name) && value == null) {
                entry.addRemovedProperty(name);
            }
            return;
        }

        if (value == null) {
            entry.addRemovedProperty(name);
        } else {
            entry.setHasChangedProperty(true);
        }
    }
}
 
开发者ID:naver,项目名称:svngit,代码行数:30,代码来源:SVNGitDAVUpdateHandler.java


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