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


Java Status.isClean方法代码示例

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


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

示例1: hasCleanWorkingDirectory

import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
public static Matcher<Git> hasCleanWorkingDirectory() {
	return new TypeSafeDiagnosingMatcher<Git>() {
		@Override
		protected boolean matchesSafely(final Git git, final Description mismatchDescription) {
			try {
				final Status status = git.status().call();
				if (!status.isClean()) {
					final String start = "Uncommitted changes in ";
					final String end = " at " + git.getRepository().getWorkTree().getAbsolutePath();
					mismatchDescription.appendValueList(start, ", ", end, status.getUncommittedChanges());
				}
				return status.isClean();
			} catch (final GitAPIException e) {
				throw new RuntimeException("Error checking git status", e);
			}
		}

		@Override
		public void describeTo(final Description description) {
			description.appendText("A git directory with no staged or unstaged changes");
		}
	};
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:24,代码来源:GitMatchers.java

示例2: hasCleanWorkingDirectory

import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
public static Matcher<Git> hasCleanWorkingDirectory() {
    return new TypeSafeDiagnosingMatcher<Git>() {
        @Override
        protected boolean matchesSafely(Git git, Description mismatchDescription) {
            try {
                Status status = git.status().call();
                if (!status.isClean()) {
                    String start = "Uncommitted changes in ";
                    String end = " at " + git.getRepository().getWorkTree().getAbsolutePath();
                    mismatchDescription.appendValueList(start, ", ", end, status.getUncommittedChanges());
                }
                return status.isClean();
            } catch (GitAPIException e) {
                throw new RuntimeException("Error checking git status", e);
            }
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("A git directory with no staged or unstaged changes");
        }
    };
}
 
开发者ID:danielflower,项目名称:multi-module-maven-release-plugin,代码行数:24,代码来源:GitMatchers.java

示例3: doExecute

import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
@Override
protected void doExecute() throws BuildException {
        Repository repo = git.getRepository();

        FileTreeIterator workingTreeIterator = new FileTreeIterator(repo);

        try {
                IndexDiff diff = new IndexDiff(repo, Constants.HEAD, workingTreeIterator);
                diff.diff();

                Status status = new Status(diff);

                if (!status.isClean()) {
                        if (modificationExistProperty != null) {
                                getProject().setProperty(modificationExistProperty, "true");
                        }

                        if (isFailOnError()) {
                                StringBuilder msg = new StringBuilder();
                                msg.append("The Git tree was modified.");
                                msg.append("\n").append("Changed:").append(status.getChanged());
                                msg.append("\n").append("Added:").append(status.getAdded());
                                msg.append("\n").append("Modified:").append(status.getModified());
                                msg.append("\n").append("Missing:").append(status.getMissing());
                                msg.append("\n").append("Removed:").append(status.getRemoved());
                                msg.append("\n").append("Untracked:").append(status.getUntracked());

                                throw new GitBuildException(String.format(STATUS_NOT_CLEAN_TEMPLATE, msg.toString()));
                        }
                } else {
                        log(MESSAGE_UPTODATE_SUCCESS);
                }
        } catch (IOException ioe) {
                throw new GitBuildException(MESSAGE_UPTODATE_FAILED, ioe);
        }

}
 
开发者ID:rimerosolutions,项目名称:ant-git-tasks,代码行数:38,代码来源:UpToDateTask.java

示例4: isDirty

import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
public static boolean isDirty(Repository repo) throws NoWorkTreeException,
            GitAPIException {
        Git git = new Git(repo);
    Status status = git.status().call();
    return !status.isClean();
}
 
开发者ID:palantir,项目名称:gradle-gitsemver,代码行数:7,代码来源:GitRepos.java

示例5: isDirty

import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
/**
 * Checks that underlying repository is dirty (modified with uncommitted changes).
 * @return true if the underlying repository is dirty, false otherwise
 * @throws GitAPIException if a git eeror occured while computing status
 * @throws NoWorkTreeException  if the underlying repsoitory directory is not git managed 
 */
public static boolean isDirty(Git git) throws NoWorkTreeException, GitAPIException {
    Status status = git.status().call();
    return !status.isClean();
}
 
开发者ID:jgitver,项目名称:jgitver,代码行数:11,代码来源:GitUtils.java


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