private void buildResult() { processResultState = wireup.buildResult(project); ProjectRepositoryState repositoryState = ProjectRepositoryState.fromProcessState(processResultState); repositoryState.setStashMessage(stashMessage); repositoryState.setSourceRepository(sourceRepository); repositoryState.setOriginalBranchName(originalBranchName); }
/** @return True if we have a valid git repo. */ protected boolean hasSourceRepository() { return getSourceRepository() != null; } }
if (repoState.hasSourceRepository()) { assert repoState.getSourceRepository() != null; final VirtualFile root = repoState.getSourceRepository().getRoot(); if (!Strings.isNullOrEmpty(repoState.getStashMessage())) { GitStashUtils.loadStashStack( project, if (!Strings.isNullOrEmpty(repoState.getOriginalBranchName())) { assert repoState.getOriginalBranchName() != null; String branchDisplayName = repoState.getOriginalBranchName(); if (branchDisplayName.length() > 10) { branchDisplayName = branchDisplayName.substring(0, 7) + "..."; final GitBrancher brancher = ServiceManager.getService(project, GitBrancher.class); brancher.checkout( repoState.getOriginalBranchName(), false, Collections.singletonList(repoState.getSourceRepository()), new Runnable() { @Override
/** Refresh the repository files. */ @SuppressWarnings("ConstantConditions") public void hardRefresh() { if (repoState.hasSourceRepository()) { List<VirtualFile> list = VfsUtil.markDirty(true, true, repoState.getSourceRepository().getRoot()); if (!list.isEmpty()) { LocalFileSystem.getInstance().refreshFiles(list, false, true, null); } } }
ProjectRepositoryState.fromProcessState(processState).clearForNextSession();
@NotNull final Ref<StashInfo> targetStash, @NotNull final VirtualFile root) { if (repoState.getSourceRepository() == null || repoState.getOriginalBranchName() == null || (!repoState .getOriginalBranchName() .equals(repoState.getSourceRepository().getCurrentBranchName()) && !repoState .getOriginalBranchName() .equals(repoState.getSourceRepository().getCurrentRevision()))) { Messages.showErrorDialog( StackdriverDebuggerBundle.getString( "clouddebug.erroroncheckout", repoState.getOriginalBranchName()), "Error"); return;
public void clearForNextSession() { setStashMessage(null); }
public ProjectRepositoryValidator(@NotNull CloudDebugProcessState processState) { this.processState = processState; repoState = ProjectRepositoryState.fromProcessState(processState); }
/** Given a {@link CloudDebugProcessState}. */ @NotNull public static ProjectRepositoryState fromProcessState( @NotNull CloudDebugProcessState processState) { ProjectRepositoryState repoState = processState.getUserData(REPO_KEY); if (repoState == null) { repoState = new ProjectRepositoryState(); processState.putUserData(REPO_KEY, repoState); } return repoState; }
@Override public void consume(StashInfo stashInfo) { if (!Strings.isNullOrEmpty(stashInfo.getMessage()) && stashInfo.getMessage().equals(repoState.getStashMessage())) { targetStash.set(stashInfo); } } });
@Override public void run() { repoState.getSourceRepository().update(); if (!targetStash.isNull()) { unstash(project, targetStash, root); } } });