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


Java WorkingTreeOptions类代码示例

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


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

示例1: run

import org.eclipse.jgit.treewalk.WorkingTreeOptions; //导入依赖的package包/类
@Override
protected void run () throws GitException {
    Repository repository = getRepository();
    org.eclipse.jgit.api.BlameCommand cmd = new Git(repository).blame();
    cmd.setFilePath(Utils.getRelativePath(getRepository().getWorkTree(), file));
    if (revision != null) {
        cmd.setStartCommit(Utils.findCommit(repository, revision));
    } else if (repository.getConfig().get(WorkingTreeOptions.KEY).getAutoCRLF() != CoreConfig.AutoCRLF.FALSE) {
        // work-around for autocrlf
        cmd.setTextComparator(new AutoCRLFComparator());
    }
    cmd.setFollowFileRenames(true);
    try {
        BlameResult cmdResult = cmd.call();
        if (cmdResult != null) {
            result = getClassFactory().createBlameResult(cmdResult, repository);
        }
    } catch (GitAPIException ex) {
        throw new GitException(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:BlameCommand.java

示例2: cacheContents

import org.eclipse.jgit.treewalk.WorkingTreeOptions; //导入依赖的package包/类
private void cacheContents (List<String> conflicts) throws IOException {
    File workTree = getRepository().getWorkTree();
    ObjectInserter inserter = getRepository().newObjectInserter();
    WorkingTreeOptions opt = getRepository().getConfig().get(WorkingTreeOptions.KEY);
    boolean autocrlf = opt.getAutoCRLF() != CoreConfig.AutoCRLF.FALSE;
    try {
        for (String path : conflicts) {
            File f = new File(workTree, path);
            Path p = null;
            try {
                p = f.toPath();
            } catch (InvalidPathException ex) {
                Logger.getLogger(CheckoutRevisionCommand.class.getName()).log(Level.FINE, null, ex);
            }
            if (p != null && Files.isSymbolicLink(p)) {
                Path link = Utils.getLinkPath(p);                                
                cachedContents.put(path, inserter.insert(Constants.OBJ_BLOB, Constants.encode(link.toString())));
            } else if (f.isFile()) {
                long sz = f.length();
                try (FileInputStream in = new FileInputStream(f)) {
                    if (autocrlf) {
                        ByteBuffer buf = IO.readWholeStream(in, (int) sz);
                        cachedContents.put(path, inserter.insert(Constants.OBJ_BLOB, buf.array(), buf.position(), buf.limit() - buf.position()));
                    } else {
                        cachedContents.put(path, inserter.insert(Constants.OBJ_BLOB, sz, in));
                    }
                }
            }
        }
        inserter.flush();
    } finally {
        inserter.release();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:CheckoutRevisionCommand.java

示例3: checkoutFile

import org.eclipse.jgit.treewalk.WorkingTreeOptions; //导入依赖的package包/类
private void checkoutFile (MergeResult<RawText> merge, String path) throws IOException {
    File file = new File(getRepository().getWorkTree(), path);
    file.getParentFile().mkdirs();
    MergeFormatter format = new MergeFormatter();
    WorkingTreeOptions opt = getRepository().getConfig().get(WorkingTreeOptions.KEY);
    try (OutputStream fos = opt.getAutoCRLF() != CoreConfig.AutoCRLF.FALSE
            ? new AutoCRLFOutputStream(new FileOutputStream(file))
            : new FileOutputStream(file)) {
        format.formatMerge(fos, merge, Arrays.asList(new String[] { "BASE", "OURS", "THEIRS" }), //NOI18N
                Constants.CHARACTER_ENCODING);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:CheckoutRevisionCommand.java

示例4: NoGitignoreIterator

import org.eclipse.jgit.treewalk.WorkingTreeOptions; //导入依赖的package包/类
public NoGitignoreIterator(
        File root,
        FS fs,
        WorkingTreeOptions options,
        FileModeStrategy fileModeStrategy
) {
    super(root, fs, options, fileModeStrategy);
}
 
开发者ID:winstonli,项目名称:writelatex-git-bridge,代码行数:9,代码来源:NoGitignoreIterator.java

示例5: run

import org.eclipse.jgit.treewalk.WorkingTreeOptions; //导入依赖的package包/类
@Override
  protected void run() throws GitException {
      Repository repository = getRepository();
      DiffFormatter formatter = new DiffFormatter(out);
      formatter.setRepository(repository);
      ObjectReader or = null;
      String workTreePath = repository.getWorkTree().getAbsolutePath();
      try {
          Collection<PathFilter> pathFilters = Utils.getPathFilters(repository.getWorkTree(), roots);
          if (!pathFilters.isEmpty()) {
              formatter.setPathFilter(PathFilterGroup.create(pathFilters));
          }
          if (repository.getConfig().get(WorkingTreeOptions.KEY).getAutoCRLF() != CoreConfig.AutoCRLF.FALSE) {
              // work-around for autocrlf
              formatter.setDiffComparator(new AutoCRLFComparator());
          }
          or = repository.newObjectReader();
          AbstractTreeIterator firstTree = getIterator(firstCommit, or);
          AbstractTreeIterator secondTree = getIterator(secondCommit, or);
          List<DiffEntry> diffEntries;
          if (secondTree instanceof WorkingTreeIterator) {
              // remote when fixed in JGit, see ExportDiffTest.testDiffRenameDetectionProblem
              formatter.setDetectRenames(false);
              diffEntries = formatter.scan(firstTree, secondTree);
              formatter.setDetectRenames(true);
              RenameDetector detector = formatter.getRenameDetector();
              detector.reset();
              detector.addAll(diffEntries);
diffEntries = detector.compute(new ContentSource.Pair(ContentSource.create(or), ContentSource.create((WorkingTreeIterator) secondTree)), NullProgressMonitor.INSTANCE);
          } else {
              formatter.setDetectRenames(true);
              diffEntries = formatter.scan(firstTree, secondTree);
          }
          for (DiffEntry ent : diffEntries) {
              if (monitor.isCanceled()) {
                  break;
              }
              listener.notifyFile(new File(workTreePath + File.separator + ent.getNewPath()), ent.getNewPath());
              formatter.format(ent);
          }
          formatter.flush();
      } catch (IOException ex) {
          throw new GitException(ex);
      } finally {
          if (or != null) {
              or.release();
          }
          formatter.release();
      }
  }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:ExportDiffCommand.java

示例6: GfsTreeIterator

import org.eclipse.jgit.treewalk.WorkingTreeOptions; //导入依赖的package包/类
private GfsTreeIterator(List<GfsTreeEntry> files) {
  super((WorkingTreeOptions) null);
  this.files = files;
  next(1);
}
 
开发者ID:beijunyi,项目名称:ParallelGit,代码行数:6,代码来源:GfsTreeIterator.java


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