Fix warnings, @NotNull

This commit is contained in:
Kirill Likhodedov
2012-03-07 20:17:25 +04:00
parent 53cff92139
commit d565f84067
@@ -43,21 +43,18 @@ import java.util.Map;
public abstract class GitUpdater {
private static final Logger LOG = Logger.getInstance(GitUpdater.class);
protected final Project myProject;
protected final VirtualFile myRoot;
protected final Map<VirtualFile, GitBranchPair> myTrackedBranches;
protected final ProgressIndicator myProgressIndicator;
protected final UpdatedFiles myUpdatedFiles;
protected final AbstractVcsHelper myVcsHelper;
protected final @NotNull Project myProject;
protected final @NotNull VirtualFile myRoot;
protected final @NotNull Map<VirtualFile, GitBranchPair> myTrackedBranches;
protected final @NotNull ProgressIndicator myProgressIndicator;
protected final @NotNull UpdatedFiles myUpdatedFiles;
protected final @NotNull AbstractVcsHelper myVcsHelper;
protected final GitVcs myVcs;
protected GitRevisionNumber myBefore; // The revision that was before update
protected GitUpdater(Project project,
VirtualFile root,
Map<VirtualFile, GitBranchPair> trackedBranches,
ProgressIndicator progressIndicator,
UpdatedFiles updatedFiles) {
protected GitUpdater(@NotNull Project project, @NotNull VirtualFile root, @NotNull Map<VirtualFile, GitBranchPair> trackedBranches,
@NotNull ProgressIndicator progressIndicator, @NotNull UpdatedFiles updatedFiles) {
myProject = project;
myRoot = root;
myTrackedBranches = trackedBranches;
@@ -69,18 +66,12 @@ public abstract class GitUpdater {
/**
* Returns proper updater based on the update policy (merge or rebase) selected by user or stored in his .git/config
*
*
* @param gitUpdateProcess
* @param root
* @param progressIndicator
* @return {@link GitMergeUpdater} or {@link GitRebaseUpdater}.
*/
public static GitUpdater getUpdater(Project project,
Map<VirtualFile, GitBranchPair> trackedBranches,
VirtualFile root,
ProgressIndicator progressIndicator,
UpdatedFiles updatedFiles) {
@NotNull
public static GitUpdater getUpdater(@NotNull Project project, @NotNull Map<VirtualFile, GitBranchPair> trackedBranches,
@NotNull VirtualFile root, @NotNull ProgressIndicator progressIndicator,
@NotNull UpdatedFiles updatedFiles) {
final GitVcsSettings settings = GitVcsSettings.getInstance(project);
if (settings == null) {
return getDefaultUpdaterForBranch(project, root, trackedBranches, progressIndicator, updatedFiles);
@@ -97,11 +88,10 @@ public abstract class GitUpdater {
return getDefaultUpdaterForBranch(project, root, trackedBranches, progressIndicator, updatedFiles);
}
private static GitUpdater getDefaultUpdaterForBranch(Project project,
VirtualFile root,
Map<VirtualFile, GitBranchPair> trackedBranches,
ProgressIndicator progressIndicator,
UpdatedFiles updatedFiles) {
@NotNull
private static GitUpdater getDefaultUpdaterForBranch(@NotNull Project project, @NotNull VirtualFile root,
@NotNull Map<VirtualFile, GitBranchPair> trackedBranches,
@NotNull ProgressIndicator progressIndicator, @NotNull UpdatedFiles updatedFiles) {
try {
final GitBranch branchName = GitBranch.current(project, root);
final String rebase = GitConfigUtil.getValue(project, root, "branch." + branchName + ".rebase");
@@ -114,6 +104,7 @@ public abstract class GitUpdater {
return new GitMergeUpdater(project, root, trackedBranches, progressIndicator, updatedFiles);
}
@NotNull
public GitUpdateResult update() throws VcsException {
markStart(myRoot);
try {
@@ -138,8 +129,9 @@ public abstract class GitUpdater {
public boolean isUpdateNeeded() throws VcsException {
GitBranchPair gitBranchPair = myTrackedBranches.get(myRoot);
String currentBranch = gitBranchPair.getBranch().getName();
assert gitBranchPair.getDest() != null;
String remoteBranch = gitBranchPair.getDest().getName();
GitBranch dest = gitBranchPair.getDest();
assert dest != null;
String remoteBranch = dest.getName();
if (! hasRemotelyChangedPaths(currentBranch, remoteBranch)) {
LOG.info("isSaveNeeded No remote changes, save is not needed");
return false;