Skip to content

Commit

Permalink
Lots of miscellaneous bug fixes, and additional logging to help pin d…
Browse files Browse the repository at this point in the history
…own some connection issues.
  • Loading branch information
groboclown committed May 9, 2017
1 parent 24ab9e9 commit 255a1e4
Show file tree
Hide file tree
Showing 21 changed files with 314 additions and 106 deletions.
14 changes: 8 additions & 6 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,21 @@

* Change "maximum timeout" setting meaning.
* The "maximum timeout" user setting hasn't been used since the 0.7
release, so it now means the maximum SO socket time to live, which
release, so it now means the maximum socket time to live, which
allows the user to avoid a potential issue with the underlying
Perforce API. (#85)
* Add lock timeout user setting.
* Allows the user to adjust how long the plugin waits for the connection
until the next one comes free.
* Useful for users that have a very slow connection to the server.
* Bug fixes.
* *In progress*
* Went back to actually using the "reconnect with each request" setting.
Before, this setting was ignored and all connections were reconnected
before being used. Users with slow connections should see a performance
boost with this disabled.
* Clarified error message when reverting files while working offline.
* Reduced number of false error messages when the plugin hasn't loaded the
client spec when requests are made.


## ::v0.8.5::
Expand All @@ -45,10 +51,6 @@
* Fixed the configuration panel width - an outer scroll pane confused the
tab layout. The blank text fields shouldn't scroll offscreen anymore.
* Fixed the SSL Fingerprint text field to correctly show the value.
* Went back to actually using the "reconnect with each request" setting.
Before, this setting was ignored and all connections were reconnected
before being used. Users with slow connections should see a performance
boost with this disabled.


## ::v0.8.4::
Expand Down
12 changes: 9 additions & 3 deletions plugin/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
<ol>
<li><em>0.8.6</em>
<ol>
<li>...</li>
<li>Change "maximum timeout" setting meaning to now mean the maximum
socket timeout to live.</li>
<li>Add lock timeout user setting.</li>
<li>Went back to actually using the "reconnect with each request" setting,
so that it can reuse the existing connection.</li>
<li>Clarified error message when reverting files while working offline.</li>
<li>Reduced number of false error messages when the plugin hasn't loaded the
client spec when requests are made.</li>
</ol>
</li>
<li><em>0.8.5</em>
Expand All @@ -22,15 +29,14 @@
<li>Fixed the SSL Fingerprint text field to correctly show the value.</li>
<li>Added user preference to change the socket SO timeout, to allow for fixing
potential SocketTimeoutExceptions.</li>
<li>Went back to actually using the "reconnect with each request" setting.</li>
</ol>
</li>
</ol>
]]></change-notes>
<description><![CDATA[
<a href="https://github.com/groboclown/p4ic4idea">[ Github ]</a> | <a href="https://github.com/groboclown/p4ic4idea/issues?q=is%3Aopen+is%3Aissue">[ Open Issues ]</a>
<p>
Associate your IDEA project with Perforce through the built-in version control.
Associate your IDEA project with Perforce ("p4") through the built-in version control.
</p>
<p>
Limitations:
Expand Down
2 changes: 1 addition & 1 deletion plugin/plugin.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="jdk" jdkName="IntelliJ IDEA Community Edition IC-171.2014.21" jdkType="IDEA JDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="TEST">
<library>
Expand Down
4 changes: 3 additions & 1 deletion plugin/src/net/groboclown/idea/p4ic/P4Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ error.opened-action-status.invalid=The following Perforce files reported an unex
error.config.invalid-roots.title=Client `{0}` Not In Project
error.config.no-workspace-roots=The Perforce client files don't seem to be in the project. You may need to update your Perforce client settings. Additionally, the IDE Perforce settings must be refreshed.
error.config.invalid-roots=The Perforce client files don't seem to be in the project. Your Perforce client has root directories {0}, but your project is configured with VCS directories {1}. You may need to update your Perforce client settings. Additionally, the IDE Perforce settings must be refreshed.
error.config.invalid-roots.exception=Workspace not synchronized.
error.config.invalid-roots.yes=&Edit Configuration
error.config.invalid-roots.no=&Cancel
error.spec.unknown-open-action=Unknown open action {1} on file {0}.
Expand Down Expand Up @@ -466,4 +467,5 @@ error.config.password.invalid=Password is incorrect.
error.config.requires-password=Password required for server connection.
configuration.tab.properties=Connection Properties
user.prefs.socket-so-timeout=RPC SO Socket Ti&meout (in ms):
user.prefs.socket-so-timeout.tooltip=Increase this number if you see "SocketTimeoutException" problems.
user.prefs.socket-so-timeout.tooltip=Increase this number if you see "SocketTimeoutException" problems.
error.revert.offline=Cannot revert files while offline.
14 changes: 10 additions & 4 deletions plugin/src/net/groboclown/idea/p4ic/config/ClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.perforce.p4java.env.PerforceEnvironment;
import net.groboclown.idea.p4ic.P4Bundle;
import net.groboclown.idea.p4ic.config.part.DataPart;
import net.groboclown.idea.p4ic.v2.server.cache.ClientServerRef;
import org.jetbrains.annotations.NotNull;
Expand All @@ -26,21 +24,24 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

/**
* Stores information regarding a server configuration and the specific client/workspace in that
* server.
*/
public class ClientConfig {
public final class ClientConfig {
private static final Logger LOG = Logger.getInstance(ClientConfig.class);


// Just some character that won't appear in any real text, but
// is still viewable in a debugger.
private static final char SEP = (char) 0x2202;

private static final AtomicInteger COUNT = new AtomicInteger(0);

private final int configVersion;
private final Project project;
private final Set<VirtualFile> rootDirs;
private final ServerConfig serverConfig;
Expand Down Expand Up @@ -71,6 +72,7 @@ private ClientConfig(@NotNull Project project, @NotNull ServerConfig serverConfi
" does not match data config " + ConfigPropertiesUtil.toProperties(data));
}
*/
this.configVersion = COUNT.incrementAndGet();

this.project = project;
this.rootDirs = Collections.unmodifiableSet(new HashSet<VirtualFile>(clientProjectBaseDirectories));
Expand Down Expand Up @@ -102,6 +104,10 @@ private ClientConfig(@NotNull Project project, @NotNull ServerConfig serverConfi
this.clientServerRef = new ClientServerRef(serverConfig.getServerName(), clientName);
}

public int getConfigVersion() {
return this.configVersion;
}

/**
*
* @return unique ID for this client, which is shared for all clients with the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

public final class ClientConfigSetup {
private final ClientConfig config;
private final Collection<ConfigProblem> configProblems;
private final DataPart source;

public ClientConfigSetup(@Nullable ClientConfig config, @Nullable Collection<ConfigProblem> configProblems,
ClientConfigSetup(@Nullable ClientConfig config, @Nullable Collection<ConfigProblem> configProblems,
@NotNull DataPart source) {
this.config = config;
this.source = source;
Expand All @@ -40,6 +41,10 @@ public ClientConfigSetup(@Nullable ClientConfig config, @Nullable Collection<Con
this.configProblems = Collections.unmodifiableCollection(problems);
}

public int getConfigVersion() {
return config.getConfigVersion();
}

@Nullable
public ClientConfig getClientConfig() {
return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import net.groboclown.idea.p4ic.config.part.*;
import net.groboclown.idea.p4ic.util.EqualUtil;
import net.groboclown.idea.p4ic.v2.server.util.FilePathUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -166,7 +167,8 @@ private void loadConfigs(ConfigPart rootPart) {
} else if (part instanceof DataPart) {
final DataPart dataPart = (DataPart) part;
VirtualFile partRoot = dataPart.getRootPath();
if (partRoot == null) {
// Push parent directories of the project root into the project root.
if (partRoot == null || (projectRoot != null && FilePathUtil.isSameOrUnder(partRoot, projectRoot))) {
partRoot = projectRoot;
}
List<DataPart> partList = dirToParts.get(partRoot);
Expand Down Expand Up @@ -204,23 +206,27 @@ private Map<VirtualFile, ClientConfig> convertToClients(
for (Map.Entry<VirtualFile, List<DataPart>> entry : parts.entrySet()) {
@Nullable
VirtualFile previous = entry.getKey();
@Nullable
VirtualFile current = previous == null
? null
: previous.getParent();
while (current != null && ! current.equals(previous) && EqualUtil.isEqual(projectRoot, current)) {
if (parts.containsKey(current)) {
for (DataPart dataPart : parts.get(current)) {
if (! entry.getValue().contains(dataPart)) {
entry.getValue().add(dataPart);
if (previous == null || (projectRoot != null && FilePathUtil.isSameOrUnder(previous, projectRoot))) {
previous = projectRoot;
}
if (previous != null) {
for (FilePath parent : FilePathUtil.getTreeTo(previous, projectRoot)) {
// Put all the parent's data parts into the child, as lower priority
// items (at the end of the child's list).
List<DataPart> parentPartList = parts.get(parent.getVirtualFile());
if (parentPartList != null) {
List<DataPart> childParts = entry.getValue();
for (DataPart dataPart : parentPartList) {
if (! childParts.contains(dataPart)) {
childParts.add(dataPart);
}
}
}
}
previous = current;
current = previous.getParent();
}
}


// We now have the complete list of client servers, mapped to
// their section in the project tree. We now need to organize these
// into shared ClientConfig objects, while maintaining their
Expand Down
10 changes: 10 additions & 0 deletions plugin/src/net/groboclown/idea/p4ic/config/ServerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.io.File;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;


/**
Expand All @@ -42,6 +43,9 @@ public final class ServerConfig {
// is still viewable in a debugger.
private static final char SEP = (char) 0x2202;

private static final AtomicInteger COUNT = new AtomicInteger(0);

private final int configVersion;
private final P4ServerName serverName;
private final String username;
private final File authTicket;
Expand Down Expand Up @@ -110,6 +114,7 @@ private ServerConfig(@NotNull DataPart part) {
if (! isValid(part)) {
throw new IllegalStateException("Did not check validity before creating");
}
this.configVersion = COUNT.incrementAndGet();

assert part.hasServerNameSet();
this.serverName = part.getServerName();
Expand Down Expand Up @@ -138,6 +143,11 @@ private ServerConfig(@NotNull DataPart part) {
}


public int getConfigVersion() {
return this.configVersion;
}


@NotNull
public P4ServerName getServerName() {
return serverName;
Expand Down
Loading

0 comments on commit 255a1e4

Please sign in to comment.