Issue while creating workspace in perforce - perforce

I am not able to create a workspace in perforce. I go to Connection --> New Workspace and then give desired workspace name and workspaceroot and then click "OK". And also it does not give any error. But when I try to access the workspace to add files in it,I am not able to access it, it gives error as "the path is not found". This means workspace has not been created in my local system. Can you please help here? I am new to perforce so please answer accordingly.

In perforce a workspace (aka client) defines the mapping of depot files to the files in your workspace (this is called the "clientview").
Most probably you made a mistake in your client view or when adding the files so that they don't fit (e.g. you can't add a file to perforce when the client does not contain a mapping for the local path it is located to a location in the depot).
In order to give better advice you need to post the content your client and the path of the files you want to add.

Related

In Perforce, how can I check in a file previously checked out on another machine/workspace?

I hope I'm not asking a question that's already been answered, but I can't seem to find one that fits my situation.
Scenario: Using P4V gui (2011 version), with no access to P4 command line, on Windows 7.
The setup: A user creates a workspace in Perforce from Machine A, pointing that workspace to a shared network drive, and checks out a file for editing.
Machine A then dies before the user can check in the file. The user is then assigned Machine B, for which he must create a new workspace (which is also pointed at the same shared network drive).
The problem: The problem we're having is that even though the workspace from the dead Machine A and from the new Machine B both point to the same location, Perforce considers them to be different workspaces and prevents the user from checking in/submitting the previously checked out file.
Any suggestions on how to check in this stranded file would be greatly appreciated. Thank you very much!
To be nice and clean, I'd suggest this:
Make a backup copy of the file as it exists on the shared network drive.
Connect to the depot from Workspace A (can be done from Machine B if the workspace isn't bound to Machine A).
Revert the file - this will overwrite the file on the drive with the version in the depot (aren't you glad you made a copy first?).
Switch to Workspace B.
Check out the file.
Copy the backup version over the file on the shared network drive.
Check in the file.
...and if you're not planning on using Workspace A anymore, I'd suggest deleting it.
Have you tried clearing out the Host field? For example, see 'Using the same workspace from different machines':
http://www.perforce.com/perforce/doc.current/manuals/p4guide/chapter.configuration.html#d0e1720
As an update from my comment response, if you need to change ownership of a changelist, the steps are documented here:
http://answers.perforce.com/articles/KB_Article/Changing-the-Owner-of-a-Pending-Changelist

Adding files to perforce client

I have a handful of new files I want to add to my client. I moved my files to the proper location but every time I do "p4 add" I get the error "file(s) not in client view". I am confused why I am getting this error message since I am trying to add new files for the first time.
Perforce correlates the location of the files on your workstation with the location of the files in the server's repository using your "workspace view", which is a crucial concept that you need to become familiar with.
Here's where to learn about it: http://www.perforce.com/perforce/doc.current/manuals/intro/01_intro.html#1079899
Since you're working with the command line p4 tool, you'll use 'p4 client' to update your workspace definition and its view mapping.
You can also use the 'p4 where' command to understand how the mapping is translating filenames to and from the client and server formats.

How can I tell which workspace a directory is in?

I need to know which workspace the directory I am running the batch script is in, so I can get a list of files that are checked out in that workspace.
Is there an easy way to do this?
I am hoping I don't need to get a list of all workspaces and then manually go through them trying to figure out which one my current directory is a child of.
I am doing this on Windows.
The name of your client is set by your P4CLIENT definition or the '-c' argument, not by your current directory. Your current directory might, however, influence the choice of a P4CONFIG file with client-side settings. Try 'p4 set' to see your client-side configuration settings.

How do I delete a file from depot, but leave local copy in tact?

I'm trying to learn Perforce and want to delete a file from the depot(easy to do with p4 delete, p4 submit), but that deletes it from the client machine dir structure as well. I want to keep my local file in my directory intact.
The only way I can see to do this would be to move it out of the hierarchy that is under Perforce control before deleting. I was able to get my file back by syncing an earlier version.
Maybe I set up my client workspace wrong? Or am I misunderstanding a fundamental concept of source control? The client workspace is /home/user and I did it this way so I could add any file under my home directory without getting an error about the file not being under client's root.
FYI - Linux client and server running P4D/LINUX26X86/2009.1/222893 (2009/11/12)
Any advice appreciated.
Thanks.
There is a way to do this, by going behind Perforce's back. Do the following:
Rename the file you want to delete to something new
Run p4 delete on the original filename
p4 submit the change
Rename the file back to the original name
I don't believe there is any way to keep a file you are deleting under Perforce. There is good reason for this, as if the file is deleted in the depot there is no reason (from a source code control perspective) to keep a copy in the client workspace.
I suspect the issue is the way you are using Perforce.
From what you have written it seems that you are using Perforce to backup/track files in your home directory structure. So the way you are using Perforce the "master" is in your home directory and the "copies" are in the depot.
This is not the intended use of a source control system as I understand it.
The master copy of all files are actually what is in the depot. From the depot, multiple clients (views) are made for purposes such as making changes, testing, and so on. The clients are transitory and can be created and deleted as required.
To do what you want to do you may need to rethink how you are using Perforce.
some of the other commands take a parameter that lets you fake the action, but delete doesn't. You could always make a new client, do the delete in that workspace.
In the Workspace tab go to folder containing file(s) to remove from source
Right-click on that directory (or from File menu) and choose Open command window here
Note - If you open your own command prompt in the source directory you may encounter this error:
"Client 'your-client' unknown - use 'client' command to create it."
Enter command p4 delete -k <file_to_delete>
Change will be added to your P4V Helix changelist ready to check in

Perforce Setup Issue

I've got a Perforce server set up, and installed the P4V client. I've created a new depot and a new workspace. Per the documentation, I've mapped the workspace to the depot. So far so good.
I now have a .SQL script that was created by an external application that I wish to check in for the first time. I copied the file into my workspace and can see the file in the client's workspace tree window. Yet when I attempt to mark the file for add, I get a "file(s) not opened on this client" error. I've tried editing a changelist to include the file, but the changelist editor does not "see" the file.
I've read through the documentation (PDF files), but I just do not see what I'm missing. I've worked with other RCS software in a commercial setting, but this is my first stab at trying to set up and administer and RCS system up for personal use.
I think your problem is likely to be with the mappings. This is a reasonably common issue.
Taking your details
Workspace root: C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666
File dir under root: C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666\tunnel_files
View mappings:
//tunnel/... //wtansill_localhost_1666/tunnel/...
//tunnel/* //wtansill_localhost_1666/tunnel/*
With the details above, the line
//tunnel/... //wtansill_localhost_1666/tunnel/...
means that you need to place the files you wish to add into the root of your workspace plus the directory tunnel eg.
C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666\tunnel
rather than
C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666\tunnel_files
where you seem to have put them. A way around this is
Create the tunnel folder in the correct place (and any subfolders)
Remove the final folder from your workspace mapping so
//tunnel/... //wtansill_localhost_1666/tunnel/...
becomes
//tunnel/... //wtansill_localhost_1666/...
this would mean anything under
C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666\tunnel_files
would be mapped to //tunnel/tunnel_files which is I think what you want.
Hope this helps.
Are you sure your filespec includes the directory you have added your file in?
Perhaps you could post your ClientSpec, and the directory in which your file is located?
Workspace root: C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666
File dir under root: C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666\tunnel_files
View mappings:
//tunnel/... //wtansill_localhost_1666/tunnel/...
//tunnel/* //wtansill_localhost_1666/tunnel/*
It's sort of a moot point though. The above workspace was the default set up by Perforce when I installed it. I deleted that workspace and created a new one using the P4V client, retraced my original steps, and now, lo, it works! Go figure.

Resources