Search in sources :

Example 1 with HgBranchesCommand

use of org.zmlx.hg4idea.command.HgBranchesCommand in project intellij-community by JetBrains.

the class HgRepositoryImpl method update.

@Override
public void update() {
    HgRepoInfo currentInfo = readRepoInfo();
    // update only if something changed!!!   if update every time - new log will be refreshed every time, too.
    // Then blinking and do not work properly;
    final Project project = getProject();
    if (!project.isDisposed() && !currentInfo.equals(myInfo)) {
        myInfo = currentInfo;
        HgCommandResult branchCommandResult = new HgBranchesCommand(project, getRoot()).collectBranches();
        if (branchCommandResult == null || branchCommandResult.getExitValue() != 0) {
            // hg executable is not valid
            LOG.warn("Could not collect hg opened branches.");
            myOpenedBranches = myInfo.getBranches().keySet();
        } else {
            myOpenedBranches = HgBranchesCommand.collectNames(branchCommandResult);
        }
        HgUtil.executeOnPooledThread(new Runnable() {

            public void run() {
                if (!project.isDisposed()) {
                    project.getMessageBus().syncPublisher(HgVcs.STATUS_TOPIC).update(project, getRoot());
                }
            }
        }, project);
    }
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) Project(com.intellij.openapi.project.Project) HgBranchesCommand(org.zmlx.hg4idea.command.HgBranchesCommand)

Aggregations

Project (com.intellij.openapi.project.Project)1 HgBranchesCommand (org.zmlx.hg4idea.command.HgBranchesCommand)1 HgCommandResult (org.zmlx.hg4idea.execution.HgCommandResult)1