groboclown / p4ic4idea

Perforce IDEA Community VCS Integration
Apache License 2.0
31 stars 11 forks source link

Cannot connect to the P4 server that requires P4HOST #208

Closed sergebat closed 4 years ago

sergebat commented 4 years ago

Describe the bug Cannot connect to the P4 repo hosted on Assembla. Log below indicates P4HOST might not be used correctly. Besides, I see the same error with p4 info if I manually unset P4HOST variable. p4 info from the command line works fine. This is just a theory though, let me know if I can help drill down into the issue further.

To Reproduce Steps to reproduce the behavior:

  1. Setup P4 variables like that as specified in the Assembla P4PORT=ssl:perforce-us-east.assembla.com:1667 P4HOST=value-redacted-contains-dashes P4USER=valueredacted P4CHARSET=utf8 P4CLIENT=my_workspace

  2. Check that p4 info works fine.

  3. Install plugin to Android Studio as per instructions. Use "Environment Variables" connection configuration settings. Observe the issue below.

Desktop:

Log (enabled "p4" in Help > Debug Log Settings): 2020-01-30 15:13:00,672 [d thread 4] WARN - nnection.P4RequestErrorHandler - Running an action with the Perforce server server:{P4TRUST=C:\Users\bat\p4trust.txt, P4PASSWD=(set), P4PORT=ssl:perforce-us-east.assembla.com:1667, P4TICKETS=C:\Users\bat\p4tickets.txt, P4USER=redacted_correct_value, P4FINGERPRINT=(unset), P4LOGINSSO=(unset)} generated an error. com.perforce.p4java.exception.ConnectionException: Unable to find destination depot You must set P4HOST variable according to the rules from your Perforce Tool information page at com.perforce.p4java.impl.mapbased.server.Server.getServerVersion(Server.java:587) at com.perforce.p4java.impl.mapbased.server.Server.connect(Server.java:611) at com.perforce.p4java.impl.mapbased.rpc.RpcServer.connect(RpcServer.java:675) at com.perforce.p4java.impl.mapbased.rpc.NtsServerImpl.connect(NtsServerImpl.java:181) at net.groboclown.p4.server.impl.connection.impl.SimpleConnectionManager.connect(SimpleConnectionManager.java:204)

groboclown commented 4 years ago

The issue here is that the P4HOST setting first comes from the client configuration setup. If it isn't there, then the plugin attempts to get the host using InetAddress.getLocalHost().getHostName() (see bug #61).

In some situations, though, the client isn't required for the operation. During the big refactoring, optimizations were made, and it looks like part of that involved removing the client configuration parameters from those non-client based operations.

groboclown commented 4 years ago

The latest release (0.10.12) should have the fix for this.

sergebat commented 4 years ago

I have just tested with 0.10.16 and confirm that the plugin connects to Assembla repository perfectly now! Thanks a lot for fixing it.