Author Topic: Cannot checkout file in Perforce.  (Read 11154 times)

nelsonhf

  • Community Member
  • Posts: 47
  • Hero Points: 2
Cannot checkout file in Perforce.
« on: October 07, 2013, 08:22:47 PM »
I have a workspace that I imported from MS Visual Studio 2008. It is stored in Perforce and everything works fine (even the Perforce plug-in for MVS).

If I try to edit in Slick Edit a file that is not checked out, I receive the expected message "This command is not allowed in read only mode"; if I click on "Change RW...", I have the option (among others) to "Check out the latest version" (still, as expected).

Clicking "OK", I receive the error: "Could not get current version of file '<filename>'" followed by "Path '<filename>' is not under client's root '<path>'".

Well... It is actually not in the path because it belongs to a different Perforce workspace...

There must be a way to indicate which Perforce workspace the files in a particular project/solution/workspace are.

I looked around in SlickEdit configuration files and in the forums but could not find anything about this (maybe I didn't look hard enough). Can anyone please help me?

Thanks

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2910
  • Hero Points: 153
Re: Cannot checkout file in Perforce.
« Reply #1 on: October 07, 2013, 08:28:52 PM »
I haven't had any of our users run into this particular problem.  If you run "p4 client" at a console window, it will launch an editor with several fields for this information.  Either the local directory, or the Perforce workspace, need to be changed.  Perforce can be a little tricky this way.  When you close the editor, that will set the information in perforce.

Hope this helps.

nelsonhf

  • Community Member
  • Posts: 47
  • Hero Points: 2
Re: Cannot checkout file in Perforce.
« Reply #2 on: October 07, 2013, 09:42:59 PM »
I went playing with "p4 client" and got burned :P. I changed the copy of one of my workspaces to another! (luckily, I had a backup)

Hint: DO NOT use p4 client -t workspace1. It will override the definition of the current workspace!  :o

But I remember that I did something sometime ago to change the workspace.

The trick is to use "p4 set P4CLIENT=<workspace>" to change the current (default) workspace.

Is there a way to link a SlickEdit project to a Perforce workspace and set P4CLIENT when that project is opened? (you'll still get weird bugs when someone else modify P4CLIENT, but this is Perforce's fault...).

Thanks

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Cannot checkout file in Perforce.
« Reply #3 on: October 08, 2013, 03:43:59 AM »
"p4 set P4CLIENT=blah" is ok if you only have one client on the machine, but it sounds like the original poster has multiple clients on the same machine.

Look into using P4CONFIG instead.  Along with setting P4CONFIG appropriately (see "p4 help variables"), also put a P4.INI file in the root of the client's local tree and put in it the variables that should be in effect for that particular client.  Such as P4PORT, P4CLIENT, etc.

nelsonhf

  • Community Member
  • Posts: 47
  • Hero Points: 2
Re: Cannot checkout file in Perforce.
« Reply #4 on: October 08, 2013, 03:03:06 PM »
Thanks!

Exactly what I needed. A minor correction, though: at least in my system (Windows 7), the reference to P4CONFIG is in p4 help environment (not variables...)

To make Perforce work in different workspaces (both SlickEdit and Perforce, in this case!):

  • Open a command line in the root directory of the Perforce Workspace (use p4 client -o <workspace> anywhere to find the "Root")
  • Type p4 set to find the current settings (if any)
  • Type p4 set P4CONFIG=P4.INI (or any other file name instead of P4.INI) to set the configuration file
  • Create a configuration file (with the name you used in the step above) with the settings to override (at the minimum, P4CLIENT)

You don't even have to reload the (SlickEdit) workspace for this to work!

I think these steps are all you need, "It worked on my computer"C