本文整理汇总了Java中org.eclipse.jgit.api.Status.hasUncommittedChanges方法的典型用法代码示例。如果您正苦于以下问题:Java Status.hasUncommittedChanges方法的具体用法?Java Status.hasUncommittedChanges怎么用?Java Status.hasUncommittedChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.api.Status
的用法示例。
在下文中一共展示了Status.hasUncommittedChanges方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: revertOrInform
import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
/**
* When there are changes in tracked files that can be reverted, calls {@link #displayRevertDialog(Val, Status)}.
* Otherwise, calls {@link #displayNoChangesDialog()}.
*/
public final void revertOrInform() {
try {
Status status = git.getOrThrow().status().call();
if (status.hasUncommittedChanges()) {
displayRevertDialog(git, status);
} else {
displayNoChangesDialog();
}
} catch (GitAPIException e) {
handleGitAPIException(e);
}
}
示例2: commitOrInform
import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
/**
* If the repository has uncommitted changes on tracked files, calls {@link #displayCommitDialog(Val, Status)};
* otherwise, calls {@link #displayNoChangesDialog()}.
*/
public final void commitOrInform() {
try {
Status status = git.getOrThrow().status().call();
if (status.hasUncommittedChanges()) {
displayCommitDialog(git, status);
} else {
displayNoChangesDialog();
}
} catch (GitAPIException e) {
handleGitAPIException(e);
}
}
示例3: refreshFileViewer
import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
/**
* Refreshes the view to show any changes that might have affected the current files.
*
* <p>If new files were added, tracked files removed, or tracked files were modified, this method
* will call {@link #displayFileViewer(Status)} if {@link Status#hasUncommittedChanges()} returns
* true and {@link #displayPlaceHolder()} if it returns false.
*/
public final void refreshFileViewer() {
try {
Status status = getGitOrThrow().status().call();
if (status.hasUncommittedChanges()) {
displayFileViewer(status);
} else {
displayPlaceHolder();
}
} catch (GitAPIException e) {
handleRefreshException(e);
}
}
示例4: refreshFileViewer
import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
/**
* Refreshes the view to show any changes that might have affected the current files.
*
* <p>If modified tracked files have been manually reverted to their previous state or other unmodified
* tracked files were modified, this method will call {@link #displayFileViewer(Status)} if
* {@link Status#hasUncommittedChanges()} returns true and {@link #displayPlaceholder()} if it returns false.
*/
public final void refreshFileViewer() {
try {
Status status = getGitOrThrow().status().call();
if (status.hasUncommittedChanges()) {
displayFileViewer(status);
} else {
displayPlaceholder();
}
} catch (GitAPIException e) {
handleRefreshException(e);
}
}
示例5: refreshView
import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
/**
* Refreshes the view to show any changes that might have affected the current files
* shown by {@link #fileViewer}.
*
* <p>If modified tracked files have been manually reverted to their previous state or other unmodified
* tracked files were modified, this method will call {@link #displayFileViewer(Status)} if
* {@link Status#hasUncommittedChanges()} returns true and {@link #displayPlaceholder()} if it returns false.
*/
protected final void refreshView() {
try {
Status status = getGitOrThrow().status().call();
if (status.hasUncommittedChanges()) {
displayFileViewer(status);
} else {
displayPlaceholder();
}
} catch (GitAPIException e) {
e.printStackTrace();
}
}
示例6: getListCellRendererComponent
import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(
JList list, Object value, int index,
boolean isSelected, boolean cellHasFocus) {
JLabel comp = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected,
cellHasFocus);
final String corpus = comp.getText();
final String corpusPath = getProject().getCorpusPath(corpus);
ImageIcon icon = IconManager.getInstance().getSystemIconForPath(corpusPath, IconSize.SMALL);
if(gitController.hasGitFolder() && gitController.isOpen()) {
try {
final Status status = gitController.status(corpus);
if(status.hasUncommittedChanges() || status.getUntracked().size() > 0) {
ImageIcon modifiedIcn =
IconManager.getInstance().createGlyphIcon('*',
FontPreferences.getTitleFont(), comp.getForeground(), comp.getBackground());
icon =
IconManager.getInstance().createIconStrip(new ImageIcon[] { icon, modifiedIcn });
}
} catch (NoWorkTreeException | GitAPIException e) {
LogUtil.warning(e);
}
}
comp.setIcon(icon);
return comp;
}
示例7: isUpToDate
import org.eclipse.jgit.api.Status; //导入方法依赖的package包/类
private static boolean isUpToDate(GitRepositoryDescriptor descriptor) {
// Initializing/checking status of/etc submodules cleanly is hard, so don't try for now.
if (descriptor.initSubmodules) {
return false;
}
Repository repository = null;
try {
repository = new FileRepositoryBuilder()
.setGitDir(descriptor.directory.getChild(Constants.DOT_GIT).getPathFile())
.setMustExist(true)
.build();
ObjectId head = repository.resolve(Constants.HEAD);
ObjectId checkout = repository.resolve(descriptor.checkout);
if (head != null && checkout != null && head.equals(checkout)) {
Status status = Git.wrap(repository).status().call();
if (!status.hasUncommittedChanges()) {
// new_git_repository puts (only) BUILD and WORKSPACE, and
// git_repository doesn't add any files.
Set<String> untracked = status.getUntracked();
if (untracked.isEmpty()
|| (untracked.size() == 2
&& untracked.contains("BUILD")
&& untracked.contains("WORKSPACE"))) {
return true;
}
}
}
} catch (GitAPIException | IOException e) {
// Any exceptions here, we'll just blow it away and try cloning fresh.
// The fresh clone avoids any weirdness due to what's there and has nicer
// error reporting.
} finally {
if (repository != null) {
repository.close();
}
}
return false;
}