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


Java NoWorkTreeException类代码示例

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


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

示例1: deleteIfUnversioned

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
private void deleteIfUnversioned(DirCache cache, String path, WorkingTreeIterator f, Repository repository, TreeWalk treeWalk) throws IOException, NoWorkTreeException {
    if (cache.getEntry(path) == null &&  // not in index 
        !f.isEntryIgnored() &&             // not ignored
        !Utils.isFromNested(f.getEntryFileMode().getBits()))
    {            
        File file = new File(repository.getWorkTree().getAbsolutePath() + File.separator + path);                        
        if(file.isDirectory()) {
            String[] s = file.list();
            if(s != null && s.length > 0) { // XXX is there no better way to find out if empty?
                // not empty
                return; 
            }
        }
        file.delete();
        listener.notifyFile(file, treeWalk.getPathString());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:CleanCommand.java

示例2: main

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
public static void main(final String[] args) throws NoWorkTreeException,
		NoHeadException, IOException, GitAPIException {
	if (args.length != 4) {
		System.err
				.println("Usage <datafile> <prefix> <repositoryDir> <outputFilePrefix>");
		System.exit(-1);
	}
	final SvnToGitMapper mapper = new SvnToGitMapper(args[2]);
	final RepentDataParser rdp = new RepentDataParser(new File(args[0]),
			mapper.mapSvnToGit(), args[1], new Predicate<Integer>() {

				@Override
				public boolean test(final Integer t) {
					return t > 250;
				}
			});
	final List<Renaming> renamings = rdp.parse();
	final Multimap<String, Renaming> renamingsPerSha = mapRenamingsToTargetSha(renamings);
	final BindingExtractor be = new BindingExtractor(args[2],
			renamingsPerSha);
	be.doWalk();

	writeJson(args[3], "_variables.json", be.renamedVariablesDatapoints);
	writeJson(args[3], "_methoddeclarations.json",
			be.renamedMethodDeclarationsDatapoints);
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:27,代码来源:RenamingDatasetExtractor.java

示例3: main

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
/**
 * @param args
 * @throws IOException
 * @throws GitAPIException
 * @throws NoHeadException
 * @throws NoWorkTreeException
 */
public static void main(final String[] args) throws IOException,
		NoWorkTreeException, NoHeadException, GitAPIException {
	if (args.length != 3) {
		System.err.println("Usage <datafile> <prefix> <repositoryDir>");
		System.exit(-1);
	}
	final SvnToGitMapper mapper = new SvnToGitMapper(args[2]);
	final RepentDataParser rdp = new RepentDataParser(new File(args[0]),
			mapper.mapSvnToGit(), args[1], new Predicate<Integer>() {

				@Override
				public boolean test(final Integer t) {
					return t < 250;
				}
			});
	final List<Renaming> renamings = rdp.parse();
	for (final Renaming renaming : renamings) {
		System.out.println(renaming);
	}
	System.out.println("Num Renamings: " + renamings.size());
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:29,代码来源:RepentDataParser.java

示例4: mapSvnToGit

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
public BiMap<Integer, String> mapSvnToGit() throws IOException,
		NoWorkTreeException, NoHeadException, GitAPIException {
	final BiMap<Integer, String> mappings = HashBiMap.create();
	final Git repository = GitCommitUtils
			.getGitRepository(repositoryDirectory);

	for (final RevCommit commit : GitCommitUtils
			.getAllCommitsTopological(repository)) {
		final String message = commit.getFullMessage();
		if (!message.contains("git-svn-id")) {
			continue;
		}
		final Matcher matcher = svnIdMatcher.matcher(message);
		matcher.find();
		mappings.put(Integer.parseInt(matcher.group(1)), commit.name());
	}

	return mappings;
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:20,代码来源:SvnToGitMapper.java

示例5: extractNewModules

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
/**
 * Extract newed or removed modules
 * 
 */
public void extractNewModules() {
	Status repositoryStatus = null;
	try {
		repositoryStatus = git.status().call();
	} catch (NoWorkTreeException | GitAPIException e) {
		e.printStackTrace();
	}
	newModules = new TreeMap<String, ChangedFile>();		
	for (String string : repositoryStatus.getUntrackedFolders()) {
		for(ChangedFile file : differences) {
			if(file.getPath().lastIndexOf(Constants.SLASH) != -1 && file.getPath().substring(0, file.getPath().lastIndexOf(Constants.SLASH)).equals(string) && !newModules.containsKey(string)) {
				ChangedFile changedFile = new ChangedFile(string, TypeChange.UNTRACKED_FOLDERS.name(), git.getRepository().getWorkTree().getAbsolutePath());
				if(!newModules.containsKey(string)) {
					newModules.put(string, changedFile);
				}
				break;
			}
		}
	}
}
 
开发者ID:SEMERU-WM,项目名称:ChangeScribe,代码行数:25,代码来源:CommitGeneralDescriptor.java

示例6: getAllBaseCommits

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
/**
 * Return a list of all the commits in the main branches. Start from HEAD
 * and then go back, always choosing the first parent commit, then reverse
 * list.
 * 
 * @param git
 * @return
 * @throws IOException
 * @throws NoWorkTreeException
 */
public static List<RevCommit> getAllBaseCommits(final Git git)
		throws NoWorkTreeException, IOException {
	final List<RevCommit> commitList = Lists.newArrayList();

	final AnyObjectId headId = git.getRepository().resolve(Constants.HEAD);

	final RevWalk walk = new RevWalk(git.getRepository());
	RevCommit currentCommit = walk.parseCommit(checkNotNull(headId));

	commitList.add(checkNotNull(currentCommit));
	while (currentCommit.getParents().length > 0) {
		currentCommit = walk.parseCommit(currentCommit.getParent(0)
				.toObjectId());
		commitList.add(checkNotNull(currentCommit));
	}

	Collections.reverse(commitList);
	return commitList;
}
 
开发者ID:mast-group,项目名称:commitmining-tools,代码行数:30,代码来源:GitCommitUtils.java

示例7: parseStagedTestNames

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
@Nullable
private Set<String> parseStagedTestNames() {
    try {
        final Status status = git.status().call();
        final Iterable<String> stagedFileNames = Iterables.concat(
                status.getAdded(),
                status.getChanged(),
                status.getRemoved()
        );
        return FluentIterable.from(stagedFileNames)
                .transform(new Function<String, String>() {
                    @Nullable
                    @Override
                    public String apply(@Nullable final String s) {
                        return parseTestName(testDefinitionsDirectory, s);
                    }
                })
                .filter(Predicates.notNull())
                .toSet();
    } catch (final GitAPIException | NoWorkTreeException e) {
        LOGGER.warn("Failed to call git status", e);
        return null;
    }
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:25,代码来源:GitProctorCore.java

示例8: createVersion

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
public SemverVersion createVersion(Repository repo, Integer buildNumber, boolean topo)
    throws MissingObjectException, IncorrectObjectTypeException, IOException,
                      NoWorkTreeException, GitAPIException {
        if (repo == null) {
            throw new SemverGitflowPlugin.VersionApplicationException(
                    "Project is not in a Git repository. Cannot use semver versioning in a non repository.");
        }
        TagVersionAndCount latestTagAndCount;
        if (topo) {
            latestTagAndCount = Tags.getTopoTagVersionAndCount(repo, prefix);
        } else {
            latestTagAndCount = Tags.getLatestTagVersionAndCount(repo, prefix);
        }
        String headCommitAbbreviation = GitRepos.getHeadCommitIdAbbreviation(repo);
        boolean isDirty = GitRepos.isDirty(repo);
        return generateVersion(latestTagAndCount, headCommitAbbreviation, buildNumber, isDirty);
}
 
开发者ID:palantir,项目名称:gradle-gitsemver,代码行数:18,代码来源:TagBasedVersionFactory.java

示例9: validateUnstable

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
private void validateUnstable(String expectedVersion,
                              int commitCount,
                              RevCommit headCommit,
                              Dirty dirty,
                              String firstModifier)
        throws NoWorkTreeException, IOException, GitAPIException {
    String headCommitId = headCommit.getId().abbreviate(7).name();
    String dirtyText = (dirty == Dirty.YES) ? ".dirty" : "";
    String expected = expectedVersion + firstModifier + commitCount + "+g"
            + headCommitId + dirtyText;
    SemverVersion version = versionFactory.createVersion(repo, null);
    Assert.assertEquals(expected, version.toString());
    Integer buildNumber = 123;
    String expectedWithBuildNumber = expectedVersion + firstModifier
            + commitCount + "+g" + headCommitId + ".b" + buildNumber
            + dirtyText;
    Assert.assertEquals(
            expectedWithBuildNumber,
            versionFactory.createVersion(repo, buildNumber).toString());
}
 
开发者ID:palantir,项目名称:gradle-gitsemver,代码行数:21,代码来源:TagBasedVersionFactoryTest.java

示例10: getOutputStream

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
/**
 * Returns an output stream that writes to this connection.
 * 
 * @return the output stream
 */
@Override
public OutputStream getOutputStream() throws IOException {
	if (VersionIdentifier.MINE.equals(currentHost)) {
      try {
        URL fileContent = FileHelper.getFileURL(path);
        return fileContent.openConnection().getOutputStream();
      } catch (NoWorkTreeException | NoRepositorySelected e) {
        throw new IOException(e);
      }
	}
	throw new IOException("Writing is permitted only in the Working Copy files.");
}
 
开发者ID:oxygenxml,项目名称:oxygen-git-plugin,代码行数:18,代码来源:GitRevisionURLHandler.java

示例11: catch

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
protected void	refreshStatus() {
	try {
		//
		// Grab our working repository
		//
		Path repoPath = ((XacmlAdminUI)getUI()).getUserGitPath();
		final Git git = Git.open(repoPath.toFile());
		//
		// Get our status
		//
		final String base;
		Status status;
		if (target == null) {
			base = ".";
		} else {
			Path relativePath = repoPath.relativize(Paths.get(target.getPath()));
			base = relativePath.toString();
		}
		if (logger.isDebugEnabled()) {
			logger.debug("Status on base: " + base);
		}
		status = git.status().addPath(base).call();
		//
		// Pass it to our container
		//
		this.container.refreshStatus(status);
		this.tableChanges.refreshRowCache();
	} catch (NoWorkTreeException | IOException | GitAPIException e) {
		String error = "Failed to refresh status: " + e.getLocalizedMessage();
		logger.error(error);
	}
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:33,代码来源:GitPushWindow.java

示例12: getWorkTree

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
@Nonnull
@Override
public File getWorkTree() throws NoWorkTreeException {
  if(workTree == null)
    throw new NoWorkTreeException();
  return workTree;
}
 
开发者ID:beijunyi,项目名称:ParallelGit,代码行数:8,代码来源:AbstractParallelGitTest.java

示例13: main

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
/**
 * @param args
 * @throws GitAPIException
 * @throws IOException
 * @throws NoHeadException
 * @throws NoWorkTreeException
 */
public static void main(final String[] args) throws NoWorkTreeException,
		NoHeadException, IOException, GitAPIException {
	if (args.length != 1) {
		System.err.println("Usage <repository>");
		System.exit(-1);
	}
	final SvnToGitMapper mapper = new SvnToGitMapper(args[0]);
	System.out.println(mapper.mapSvnToGit());
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:17,代码来源:SvnToGitMapper.java

示例14: getWorkingDirFiles

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
public ArrayList<RepositoryFile> getWorkingDirFiles() {

		// TODO: check if working dir is up to date
		ArrayList<RepositoryFile> workingDirFiles = null;
		File workingDir;
		try {
			workingDir = GitHandler.gitRepository.getRepository().getWorkTree();
			workingDirFiles = getWorkingDirFilesPath(workingDir);
		} catch (NoWorkTreeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return workingDirFiles;
	}
 
开发者ID:XMLVersioningFramework,项目名称:XMLVersioningFramework,代码行数:16,代码来源:GitHandler.java

示例15: statis

import org.eclipse.jgit.errors.NoWorkTreeException; //导入依赖的package包/类
public Status statis(String ... paths) throws NoWorkTreeException, GitAPIException {
	if(git == null)
		throw new NoWorkTreeException();
	StatusCommand status = git.status();
	for(String path:paths) status.addPath(path);
	return status.call();
}
 
开发者ID:phon-ca,项目名称:phon,代码行数:8,代码来源:ProjectGitController.java


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