Managing workspace specifications
A workspace specification defines which portion of the depot can be accessed from that workspace and specifies where local copies of files in the depot are stored. This location is called the workspace. A computer can contain multiple workspaces. A workspace is required when connecting to a Perforce service if you intend to work with files.
The mapping of depot files to local files is called the workspace view. If you are working with streams, the workspace view is generated by Perforce, based on the structure of the stream. If the structure of the stream changes, the workspace view is updated automatically. (In fact, you cannot manually edit the view of a stream workspace.) If you use classic depots, you must define and maintain the workspace view manually.
Creating workspaces
To create a new workspace in P4VS:
-
Open the Open Connection dialog.
For more information, see Connecting to Perforce services.
- Click the New… button next to the Workspace field to open the New Workspace dialog.
- Enter a workspace name and click OK.
-
In the Workspace dialog, view or enter the following settings:
Setting Description Workspace
Workspace name. Defaults from the New Workspace dialog.
Owner
The user who created the specification. Defaults to you when you create a new workspace.
Host
(optional) The computer where the workspace resides. To enable the workspace to be used from any machine, leave this field blank.
Submit options
Configures what happens when users submit files.
Line endings
The line-end convention used for storing text files on the workspace computer:
- Local: Uses the workspace platform default
- Unix:
LF
- Mac:
CR
- Windows:
CRLF
- Share: Line endings are
LF
. AnyCR
prior to a line ending is removed for storage or syncing (for disks shared between UNIX and Windows)
Description
Your own explanation of the purpose of the workspace, or any related information you want to specify.
Root
Workspace root directory where you want local copies of depot files stored.
Alt Roots
For workspace specifications used from hosts on different platforms, a list of workspace roots in host-platform-specific syntax.
Options
allwrite
: All files in the workspace are writable (can be modified).clobber
: Syncing files overwrites writable files on the workspace.compress
: Compresses data sent between the workspace and the Perforce service.locked
: Only the owner of the workspace can use, change, or delete the workspace specification.modtime
: Modification time for files edited in the client workspace is set to the time when the file is submitted to the depot.rmdir
: Deletes a workspace folder if all the files contained in the folder are removed.
Stream Root
Root directory for a workspace associated with a mainline stream. For more information on streams and how the Perforce service handles stream workspaces, see Stream workspaces.
View
The workspace view determines which portions of the depot are visible in your Workspace Tree and where local copies of depot files are stored in your workspace. If you use streams, the workspace view is generated and updated automatically. For more information on workspace views, see Defining a workspace view.
- Click OK to save your entries and create the workspace specification.
Changing your workspace
To change the workspace you are using, use the Open Connection dialog and specify the workspace in the Workspace field.
For more information, see Connecting to Perforce services.
Viewing workspaces
To view all of the workspaces for the service to which you are connected, do either of the following:
-
Go to View > Workspaces in the Visual Studio menu bar to open the Workspaces tool window.
Click a workspace row to display the details of the client workspace specification.
To change the order in which columns are displayed, drag the column headings right or left to the desired position. To sort by column, click the sort arrow on a column heading.
-
Open the Open Connection dialog and click the Workspace Browse… button to open the Workspace Browser dialog.
Click a workspace row to display the details of the client workspace specification.
For more information, see Connecting to Perforce services.
Stream workspaces
If you work with streams, P4VS uses workspaces differently than it does with classic depots. For more information, see the "Streams" chapter in the Helix Versioning Engine User Guide>.
Defining a workspace view
The workspace view (sometimes called a client view) determines which portions of the depot are available for you to work with in P4VS and where local copies of depot files are stored in your workspace. If you use streams, the workspace view is generated and updated automatically. If you use classic depots, you must maintain the view manually, as described in this topic.
To define or change the workspace view for an existing workspace:
- Select View > Workspaces. The Workspaces tab is displayed.
- Context-click the workspace and select Edit Workspace. The Workspace form is displayed.
- Edit the View field. Define the view as described under Syntactic view specification.
- When you have finished editing, save your changes.
To define the workspace view for a new workspace:
-
Open the Open Connection dialog.
For more information, see Connecting to Perforce services.
- Click the New… button next to the Workspace field to open the New Workspace dialog.
- Enter a workspace name and click OK.
- In the Workspace dialog, edit the View field. Define the view as described under Syntactic view specification.
Syntactic view specification
Type your view specification using Perforce client view syntax. Views consist of mappings, one per line. The left-hand side of the mapping specifies the depot files and the right-hand side specifies the location in the workspace where the depot files reside when they are retrieved from the depot. Example:
//depot/... //bruno/depot/... //user_depot/... //bruno/user_depot/... //projects/... //bruno/myprojects/...
For details about client view syntax, refer to the P4 User Guide.