Control your Perforce connection

In IntelliJ IDEA 10.5 we’ve improved setting up your Perforce server connection and connection state diagnostics.

Configuring connections

If you are using P4CONFIG files for configuration, IntelliJ IDEA shows what config files it has found and what other default settings are used. This way you can be sure that your P4CONFIG files are found and taken into account.

Use the ‘Test Connection’ button in ‘Settings | Version Control | VCSs | Perforce’ to see this information.

Moreover, in case you specified a wrong client workspace and your project roots do not match with the workspace roots, you are also clearly prompted:

Perforce connection parameters dialog

If you are not authenticated to the server or the authentication ticket has expired, you will be notified accordingly:
Not logged to Perforce notification

Offline mode

Once Perforce server becomes unavailable, IntelliJ IDEA switches to the offline mode automatically and displays an offline notification.
"Perforce is offline" notification

In the offline mode, you can continue working locally as usual, file checkouts are remembered by IntelliJ IDEA to be further re-played. When going online IntelliJ IDEA requires that you authenticate on the server and the ticket is not expired. This is important to re-play you offline edits properly.

This entry was posted in New Features and tagged , , . Bookmark the permalink.

21 Responses to Control your Perforce connection

  1. Alexander Chuprin says:

    Hi.
    How i can define perforce executable path globally for all projects? Not per one.
    Now i need to do it for every created project.
    Thanks.

  2. Fredrik says:

    Good stuff, thanks!

  3. Vampire says:

    @Alexander Chuprin: Configure it in the default settings, then it is filled in automatically if you create a new project. Either go to the settings while no project is open or go to “File -> Other Settings -> Template Setting”

  4. Irina Chernushina (JetBrains) says:

    @Alexander: Close all projects, go to Settings, and change perforce executable path (it will change it for default project settings).
    After that, every new project will be created with this setting.

    For existing projects you can only change them one-by-one.

  5. pmac says:

    Hi – this sounds good. An unrelated question: Is it possible to associate different P4 clients with different intelliJ modules? Or is a P4 client 1-to-1 with an intelliJ project?

  6. Irina Chernushina (JetBrains) says:

    @pmac No, you define P4 client executable on the project level. Why do you need that on module level?

  7. Luke says:

    I just ran across this functionality yesterday – very useful stuff.

  8. pmac says:

    @Irina Our build system enforces that we have certain modules in certain P4 clients, based on dependency. So I have a ‘core’ client with low-level modules, and an ‘apps’ client, which uses stuff in ‘core’. That’s just how it works, but maybe that is highly unusual. I, for one, would love to be able to have one project with some modules using ClientA and some using ClientB.

  9. Irina Chernushina (JetBrains) says:
  10. pmac says:

    Yep – so I have have two P4 Clients. Some modules in my intelliJ project map to ClientA and some map to ClientB, but so far as I can tell, intelliJ expects all modules in a project to map to one client, so I must choose to manage either ClientA or ClientB through intelliJ, but not both.

  11. Irina Chernushina (JetBrains) says:

    @pmac You can use P4CONFIG files with IDEA.
    (http://www.perforce.com/perforce/r10.2/manuals/p4guide/02_config.html#1081890)
    Define 2 files – one with parameters for clientA, another for clientB.
    (Either define P4CONFIG variable
    http://www.perforce.com/perforce/r10.2/manuals/cmdref/env.P4CONFIG.html#1040647
    or use default name (p4config for Windows, .p4config for other OS))
    Put this files into root directories of your modules, or in any directory above.
    In settings (Settings -> Version Control -> VCSs -> Perforce) define that P4CONFIG or default connection will be used.
    Check that your config files are found by IDEA with Test Connection button.

  12. pmac says:

    Irina, thank you very much! That’s fantastic.

  13. Jim C. says:

    So what I have is a perforce workspace shared across Linux and Windows. On windows, it is mounted at -> Z:p4ws[client_name], however my InteliJ IDEA workspace is C:Usersjamescolworkspace. The IntelliJ workspace is where I am keeping the *.iml files etc. I have both set up so that C:Usersjamescolworkspace has no version control specified and Z:p4ws[client_name] has perforce specified. The client was originally created on Linux. The maven project imports without incident.

    Now to the problem: On each connection attempt, I get Client Unknown. The p4v GUI sees everything fine. I noticed that the p4config file spec displayed is Z:/p4ws/client_name in the display but what I entered was Z:p4wsclient_name (windows backslashes).

    Any hints I can get? I really need this to run on Windows as there are like 20 some odd servers running on the Linux box.

  14. Jim C. says:

    Figured this out. In the P4CONFIG file there is a P4PORT setting that is actually HOST:PORT rather than just port.

  15. Bill R says:

    We have a tree checked out of P4 that had a tree of files checked out to be writable, so when making changes in IJ, it was not asking to check out under p4. So we created a new p4 workspace, and loaded that into IJ and set VC=P4, verifying that the connection is good. Now on making a change to a file, it asks whether to check out, but when it tries to, it complains that the file is not under the client’s root, giving the root+path of the file under the original workspace.

    What to do?

  16. Bill R says:

    Followup: this is on Win7. We had tried setting P4CLIENT to the name of the new workspace in the User env variables, but this didn’t work. However when we set the same in the System variables, things are now working ok.

  17. miles zarathustra says:

    My perforce used to work just fine in IntelliJ, but recently (I forget when) it stopped working.

    Looking into it now, I see that it says “no config file.” Yet, P4CONFIG is defined properly and there is indeed a config file IN THE PROJECT DIRECTORY. So I guess you all changed where it looks for the config?

    If I use p4 from the command line within the project directory, it works fine. Idea can’t figure it out any more, but it used to be able to. Now I will configure P4 by hand in the idea project. Painful.
    :-(

  18. miles zarathustra says:

    AND … your captchas are obnoxious! If you miss (which is easy to do) it deletes the message. :-( :-(

  19. Peter Gromov says:

    miles zarathustra, please file a YouTrack ticket about this issue.

  20. rohit says:

    my project root and perforce workspace do not match. I have set up only a portion of my perforce workspace in idea. On testing connection it says wrong client specification. how can I integrate my project with perforce. Moreover is there a way to integrate only one module with perforce ?

  21. Peter Gromov says:

    rohit, could you please file a YouTrack request (http://youtrack.jetbrains.com) with some screenshots illustrating the problem?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>