本文整理汇总了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");
}
};
}
示例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");
}
};
}
示例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);
}
}
示例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();
}
示例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();
}