org.eclipse.jgit.util.FS.exists()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(179)

本文整理了Java中org.eclipse.jgit.util.FS.exists()方法的一些代码示例,展示了FS.exists()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FS.exists()方法的具体详情如下:
包路径:org.eclipse.jgit.util.FS
类名称:FS
方法名:exists

FS.exists介绍

[英]Tests if the path exists, in case of a symbolic link, true even if the target does not exist
[中]如果是符号链接,则测试路径是否存在,即使目标不存在,也测试为true

代码示例

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public boolean exists() {
  return fs.exists(objects);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

@Override
  public boolean isModified(File path) {
    return FS.DETECTED.exists(path);
  }
};

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

private static void loadRulesFromFile(IgnoreNode r, File exclude)
      throws FileNotFoundException, IOException {
    if (FS.DETECTED.exists(exclude)) {
      try (FileInputStream in = new FileInputStream(exclude)) {
        r.parse(in);
      }
    }
  }
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

if ((options & SKIP_MISSING) != 0 && !fs.exists(f))
  return;
  if ((options & RETRY) != 0 && fs.exists(f)) {
    for (int i = 1; i < 10; i++) {
      try {

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

File of = new File(workTree, tw.getPathString());
File parentFolder = of.getParentFile();
if (!fs.exists(parentFolder)) {
  parentFolder.mkdirs();

代码示例来源:origin: berlam/github-bucket

@Override
  public boolean isModified(File path) {
    return FS.DETECTED.exists(path);
  }
};

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

@Override
  public boolean isModified(File path) {
    return FS.DETECTED.exists(path);
  }
};

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

@Override
public boolean exists() {
  return fs.exists(objects);
}

代码示例来源:origin: berlam/github-bucket

/** {@inheritDoc} */
@Override
public boolean exists() {
  return fs.exists(objects);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

String r = removed.get(i);
file = new File(repo.getWorkTree(), r);
if (!file.delete() && repo.getFS().exists(file)) {

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

if (!fs.exists(refFile)) {
  continue;

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

private RevCommit checkoutCurrentHead() throws IOException, NoHeadException {
  ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$
  if (headTree == null)
    throw new NoHeadException(
        JGitText.get().cannotRebaseWithoutCurrentHead);
  DirCache dc = repo.lockDirCache();
  try {
    DirCacheCheckout dco = new DirCacheCheckout(repo, dc, headTree);
    dco.setFailOnConflict(false);
    dco.setProgressMonitor(monitor);
    boolean needsDeleteFiles = dco.checkout();
    if (needsDeleteFiles) {
      List<String> fileList = dco.getToBeDeleted();
      for (String filePath : fileList) {
        File fileToDelete = new File(repo.getWorkTree(), filePath);
        if (repo.getFS().exists(fileToDelete))
          FileUtils.delete(fileToDelete, FileUtils.RECURSIVE
              | FileUtils.RETRY);
      }
    }
  } finally {
    dc.unlock();
  }
  try (RevWalk rw = new RevWalk(repo)) {
    RevCommit commit = rw.parseCommit(repo.resolve(Constants.HEAD));
    return commit;
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

private static void loadRulesFromFile(IgnoreNode r, File exclude)
      throws FileNotFoundException, IOException {
    if (FS.DETECTED.exists(exclude)) {
      FileInputStream in = new FileInputStream(exclude);
      try {
        r.parse(in);
      } finally {
        in.close();
      }
    }
  }
}

代码示例来源:origin: berlam/github-bucket

private static void loadRulesFromFile(IgnoreNode r, File exclude)
      throws FileNotFoundException, IOException {
    if (FS.DETECTED.exists(exclude)) {
      try (FileInputStream in = new FileInputStream(exclude)) {
        r.parse(in);
      }
    }
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

/**
 * Writes merged file content to the working tree.
 *
 * @param result
 *            the result of the content merge
 * @return the working tree file to which the merged content was written.
 * @throws FileNotFoundException
 * @throws IOException
 */
private File writeMergedFile(MergeResult<RawText> result)
    throws FileNotFoundException, IOException {
  File workTree = db.getWorkTree();
  FS fs = db.getFS();
  File of = new File(workTree, tw.getPathString());
  File parentFolder = of.getParentFile();
  if (!fs.exists(parentFolder))
    parentFolder.mkdirs();
  try (OutputStream os = new BufferedOutputStream(
      new FileOutputStream(of))) {
    new MergeFormatter().formatMerge(os, result,
        Arrays.asList(commitNames), CHARACTER_ENCODING);
  }
  return of;
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit.junit

long sleepTime = 64;
FS fs = FS.DETECTED;
if (lastFile != null && !fs.exists(lastFile))
  throw new FileNotFoundException(lastFile.getPath());
File tmp = File.createTempFile("FileTreeIteratorWithTimeControl", null);

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.junit

long sleepTime = 64;
FS fs = FS.DETECTED;
if (lastFile != null && !fs.exists(lastFile))
  throw new FileNotFoundException(lastFile.getPath());
File tmp = File.createTempFile("FileTreeIteratorWithTimeControl", null);

代码示例来源:origin: berlam/github-bucket

File of = new File(workTree, tw.getPathString());
File parentFolder = of.getParentFile();
if (!fs.exists(parentFolder)) {
  parentFolder.mkdirs();

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

private RevCommit checkoutCurrentHead() throws IOException, NoHeadException {
  ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$
  if (headTree == null)
    throw new NoHeadException(
        JGitText.get().cannotRebaseWithoutCurrentHead);
  DirCache dc = repo.lockDirCache();
  try {
    DirCacheCheckout dco = new DirCacheCheckout(repo, dc, headTree);
    dco.setFailOnConflict(false);
    boolean needsDeleteFiles = dco.checkout();
    if (needsDeleteFiles) {
      List<String> fileList = dco.getToBeDeleted();
      for (String filePath : fileList) {
        File fileToDelete = new File(repo.getWorkTree(), filePath);
        if (repo.getFS().exists(fileToDelete))
          FileUtils.delete(fileToDelete, FileUtils.RECURSIVE
              | FileUtils.RETRY);
      }
    }
  } finally {
    dc.unlock();
  }
  try (RevWalk rw = new RevWalk(repo)) {
    RevCommit commit = rw.parseCommit(repo.resolve(Constants.HEAD));
    return commit;
  }
}

代码示例来源:origin: berlam/github-bucket

private RevCommit checkoutCurrentHead() throws IOException, NoHeadException {
  ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$
  if (headTree == null)
    throw new NoHeadException(
        JGitText.get().cannotRebaseWithoutCurrentHead);
  DirCache dc = repo.lockDirCache();
  try {
    DirCacheCheckout dco = new DirCacheCheckout(repo, dc, headTree);
    dco.setFailOnConflict(false);
    dco.setProgressMonitor(monitor);
    boolean needsDeleteFiles = dco.checkout();
    if (needsDeleteFiles) {
      List<String> fileList = dco.getToBeDeleted();
      for (String filePath : fileList) {
        File fileToDelete = new File(repo.getWorkTree(), filePath);
        if (repo.getFS().exists(fileToDelete))
          FileUtils.delete(fileToDelete, FileUtils.RECURSIVE
              | FileUtils.RETRY);
      }
    }
  } finally {
    dc.unlock();
  }
  try (RevWalk rw = new RevWalk(repo)) {
    RevCommit commit = rw.parseCommit(repo.resolve(Constants.HEAD));
    return commit;
  }
}

相关文章