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


Java Repository.getDirectory方法代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.Repository.getDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java Repository.getDirectory方法的具体用法?Java Repository.getDirectory怎么用?Java Repository.getDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.lib.Repository的用法示例。


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

示例1: test199443_GlobalIgnoreFile

import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
public void test199443_GlobalIgnoreFile () throws Exception {
    File f = new File(new File(workDir, "nbproject"), "file");
    f.getParentFile().mkdirs();
    f.createNewFile();
    File ignoreFile = new File(workDir.getParentFile(), "globalignore");
    write(ignoreFile, ".DS_Store\n.svn\nnbproject\nnbproject/private\n");
    Repository repo = getRepository(getLocalGitRepository());
    StoredConfig cfg = repo.getConfig();
    cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_EXCLUDESFILE, ignoreFile.getAbsolutePath());
    cfg.save();
    GitClient client = getClient(workDir);
    assertEquals(Status.STATUS_IGNORED, client.getStatus(new File[] { f }, NULL_PROGRESS_MONITOR).get(f).getStatusIndexWC());
    
    // now since the file is already ignored, no ignore file should be modified
    assertEquals(0, client.ignore(new File[] { f }, NULL_PROGRESS_MONITOR).length);
            
    // on the other hand, if .git/info/exclude reverts the effect of global excludes file, ignored file should be modified
    File dotGitIgnoreFile = new File(new File(repo.getDirectory(), "info"), "exclude");
    dotGitIgnoreFile.getParentFile().mkdirs();
    write(dotGitIgnoreFile, "!/nbproject/");
    assertEquals(Status.STATUS_ADDED, client.getStatus(new File[] { f }, NULL_PROGRESS_MONITOR).get(f).getStatusIndexWC());
    assertEquals(dotGitIgnoreFile, client.ignore(new File[] { f }, NULL_PROGRESS_MONITOR)[0]);
    assertEquals(Status.STATUS_IGNORED, client.getStatus(new File[] { f }, NULL_PROGRESS_MONITOR).get(f).getStatusIndexWC());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:IgnoreTest.java

示例2: detectAtCommit

import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
public void detectAtCommit(Repository repository, String commitId, StructuralDiffHandler handler) {
	File metadataFolder = repository.getDirectory();
	File projectFolder = metadataFolder.getParentFile();
	GitService gitService = new GitServiceImpl();
	//RevWalk walk = new RevWalk(repository);
	try (RevWalk walk = new RevWalk(repository)) {
		RevCommit commit = walk.parseCommit(repository.resolve(commitId));
		if (commit.getParentCount() == 1) {
		    walk.parseCommit(commit.getParent(0));
		    this.detectRefactorings(gitService, repository, handler, projectFolder, commit);
		}
	} catch (Exception e) {
	    logger.warn(String.format("Ignored revision %s due to error", commitId), e);
	    handler.handleException(commitId, e);
       }
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:17,代码来源:GitHistoryStructuralDiffAnalyzer.java

示例3: writeTodoFile

import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
private void writeTodoFile (Repository repository, List<RebaseTodoLine> steps) throws IOException {
    File f = new File(repository.getDirectory(), SEQUENCER);
    if (f.canWrite()) {
        RebaseTodoFile todoFile = new RebaseTodoFile(repository);
        todoFile.writeRebaseTodoFile(SEQUENCER + File.separator + SEQUENCER_TODO, steps, false);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CherryPickCommand.java

示例4: readTodoFile

import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
private List<RebaseTodoLine> readTodoFile (Repository repository) throws IOException {
    String path = SEQUENCER + File.separator + SEQUENCER_TODO;
    File f = new File(repository.getDirectory(), path);
    if (f.canRead()) {
        RebaseTodoFile todoFile = new RebaseTodoFile(repository);
        return todoFile.readRebaseTodo(SEQUENCER + File.separator + SEQUENCER_TODO, true);
    }
    return Collections.<RebaseTodoLine>emptyList();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CherryPickCommand.java

示例5: getMergeBase

import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
/**
    * @return
    * 			merge base of specified commits, or <tt>null</tt> if two commits do not have related history. In this 
    * 			case, these two commits can not be merged
    */
   @Nullable
public static ObjectId getMergeBase(Repository repository1, ObjectId commit1, 
		Repository repository2, ObjectId commit2, @Nullable String fetchRef) {
	if (repository1.getDirectory()!=null && repository1.getDirectory().equals(repository2.getDirectory())) {
		return GitUtils.getMergeBase(repository1, commit1, commit2);
	} else {
		fetch(repository2, commit2, repository1, fetchRef);
		return ObjectId.fromString(new CalcMergeBaseCommand(repository1.getDirectory())
				.rev1(commit1.name())
				.rev2(commit2.name())
				.call());
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:19,代码来源:GitUtils.java

示例6: initGit

import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
/**
 * Create local .git with remote info
 *
 * @return .git file path, /targetDir/.git
 */
private File initGit(Set<String> checkoutFiles) throws GitException {
    try (Git git = Git.init().setDirectory(targetDir.toFile()).call()) {
        Repository repository = git.getRepository();
        File gitDir = repository.getDirectory();
        setSparseCheckout(gitDir, checkoutFiles);
        configRemote(repository.getConfig(), "origin", gitUrl);
        return gitDir;
    } catch (GitAPIException e) {
        throw new GitException("Fail to init git repo at: " + targetDir, e);
    }
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:17,代码来源:JGitBasedClient.java

示例7: detect

import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
private void detect(GitService gitService, Repository repository, final StructuralDiffHandler handler, Iterator<RevCommit> i) {
	int commitsCount = 0;
	int errorCommitsCount = 0;

	File metadataFolder = repository.getDirectory();
	File projectFolder = metadataFolder.getParentFile();
	String projectName = projectFolder.getName();
	
	long time = System.currentTimeMillis();
	while (i.hasNext()) {
		RevCommit currentCommit = i.next();
		try {
			detectRefactorings(gitService, repository, handler, projectFolder, currentCommit);
			
		} catch (Exception e) {
			logger.warn(String.format("Ignored revision %s due to error", currentCommit.getId().getName()), e);
			handler.handleException(currentCommit.getId().getName(), e);
			errorCommitsCount++;
		}

		commitsCount++;
		long time2 = System.currentTimeMillis();
		if ((time2 - time) > 20000) {
			time = time2;
			logger.info(String.format("Processing %s [Commits: %d, Errors: %d]", projectName, commitsCount, errorCommitsCount));
		}
	}

	handler.onFinish(commitsCount, errorCommitsCount);
	logger.info(String.format("Analyzed %s [Commits: %d, Errors: %d]", projectName, commitsCount, errorCommitsCount));
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:32,代码来源:GitHistoryStructuralDiffAnalyzer.java

示例8: CommitIdDatabase

import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
CommitIdDatabase(Repository repo) {
    // NB: We enable fsync only when our Git repository has been configured so,
    //     because there's no point of doing fsync only on this file when the
    //     Git repository does not.
    this(repo.getDirectory(), repo.getConfig().getBoolean(CONFIG_CORE_SECTION, "fsyncObjectFiles", false));
}
 
开发者ID:line,项目名称:centraldogma,代码行数:7,代码来源:CommitIdDatabase.java


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