Skip to content

Commit

Permalink
Gate SVN history authentication calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed Dec 19, 2011
1 parent 218cd95 commit 7300328
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
Expand Down Expand Up @@ -353,8 +354,7 @@ public void onShow()
if (!initialized_)
{
initialized_ = true;
strategy_.addDataDisplay(view_.getDataDisplay());
strategy_.refreshCount();
strategy_.initializeHistory(view_.getDataDisplay());
}
view_.onShow();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ void showCommit(String commitId,
void onRangeChanged(HasData<CommitInfo> display);

void refreshCount();

void initializeHistory(HasData<CommitInfo> dataDisplay);
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ public void refreshCount()
dataProvider_.refreshCount();
}

@Override
public void initializeHistory(HasData<CommitInfo> dataDisplay)
{
addDataDisplay(dataDisplay);
refreshCount();
}

private final GitServerOperations server_;
private final GitHistoryAsyncDataProvider dataProvider_;
private final GitState vcsState_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.view.client.HasData;
import com.google.inject.Inject;
import org.rstudio.core.client.Debug;
import org.rstudio.core.client.files.FileSystemItem;
import org.rstudio.core.client.jsonrpc.RpcObjectList;
import org.rstudio.studio.client.common.vcs.SVNServerOperations;
import org.rstudio.studio.client.server.ServerError;
import org.rstudio.studio.client.server.ServerRequestCallback;
import org.rstudio.studio.client.workbench.views.vcs.common.events.VcsRefreshHandler;
import org.rstudio.studio.client.workbench.views.vcs.dialog.CommitCount;
import org.rstudio.studio.client.workbench.views.vcs.dialog.CommitInfo;
import org.rstudio.studio.client.workbench.views.vcs.dialog.HistoryStrategy;
import org.rstudio.studio.client.workbench.views.vcs.svn.model.SVNState;
Expand Down Expand Up @@ -102,6 +106,35 @@ public void refreshCount()
dataProvider_.refreshCount();
}

@Override
public void initializeHistory(final HasData<CommitInfo> dataDisplay)
{
// Run a very short svnHistory call before allowing initialization to
// proceed. We do this to force authentication to happen in a predictable
// way, whereas without this mechanism, three different auth prompts
// happen at the same time.

server_.svnHistory(
-1, null, 0, 1, "",
new ServerRequestCallback<RpcObjectList<CommitInfo>>()
{
@Override
public void onResponseReceived(RpcObjectList<CommitInfo> infos)
{
addDataDisplay(dataDisplay);
refreshCount();
}

@Override
public void onError(ServerError error)
{
/* TODO: This may need to do a retry or something, depending
on how it goes with JJ's refactor of SVN auth */
Debug.logError(error);
}
});
}

private int parseRevision(String revision)
{
int rev;
Expand Down

0 comments on commit 7300328

Please sign in to comment.