Workspace
Wraps a Plastic SCM workspace with operations for branching, changeset switching, source control (checkout, check-in, add, undo), change detection, and link management (xlinks and symlinks).
Definition
Namespace: Paragon.Editor.ModuleManager.Plastic Assembly: Paragon.Editor.dll
internal class Workspace : IEquatable<Workspace>Implements: IEquatable<Workspace>
Remarks
Workspace is the most feature-rich class in the PlasticSCM subsystem. It wraps Plastic SCM's WorkspaceInfo and provides two categories of operations:
Standard source control — checkout, check-in, add, branch switching, change detection, undo
Link management — creating/modifying/removing xlinks and symlinks (used by the module mounting system)
Command Execution
Some operations (xlink creation/modification, symlink creation) are not available through the Plastic SCM API and are instead executed via the cm CLI using CmdRunner.ExecuteCommandWithResult. On macOS/Unix, the cm binary is resolved to /usr/local/bin/cm as a platform workaround.
Change Detection
GetChanges() uses WorkspaceStatusOptions flags to control what types of changes are detected. The default options (default_change_options) include:
FindAllControlledChanges— modified tracked filesFindAllLocalChanges— locally changed filesFindPrivates— untracked private files
Changes can be filtered by a base path, which checks if each change's path is a subdirectory of the specified path.
Equality
Two workspaces are equal if their WorkspaceInfo instances are equal. GetHashCode() is based on the Path string.
Quick Lookup
Get workspace name
workspace.Name
Get workspace path
workspace.Path
Get parent repository
workspace.Repository
Get current branch
workspace.GetCurrentBranch()
Switch branch
workspace.SwitchBranch("/main/dev")
Get current changeset
workspace.GetCurrentChangeset()
Switch changeset
workspace.SwitchChangeset(changesetId)
Checkout files
workspace.Checkout("file1.cs", "file2.cs")
Check in files
workspace.CheckIn("Fix bug", "file1.cs")
Add files
workspace.Add("newfile.cs")
Check for changes
workspace.HasChanges()
Get all changes
workspace.GetChanges()
Undo all changes
workspace.UndoAllChanges()
Create xlink
workspace.CreateXlink(path, relPath, changeset, repo)
Modify xlink
workspace.ModifyXlink(path, relPath, changeset, repo)
Create symlink
workspace.CreateSymlink(source, mount)
Remove any link
workspace.RemoveLink(linkPath)
Check for xlink
workspace.HasXlink(path)
Try get xlink
workspace.TryGetXlink(path, out xlink)
List all xlinks
workspace.GetAllXlinks()
Properties
Info
WorkspaceInfo
public
Raw Plastic SCM workspace info
Repository
Repository
public
The parent repository
Name
string
public
Workspace name
Path
string
public
Workspace client path (filesystem root)
Constructors
Workspace(Repository, WorkspaceInfo)
Creates a workspace wrapper linked to its parent repository.
Methods
Branch Operations
GetCurrentBranch
Returns the current working branch for this workspace.
SwitchBranch
Switches the workspace to the specified branch (by name).
Changeset Operations
GetCurrentChangeset
Returns the changeset currently loaded in the workspace.
SwitchChangeset
Updates the loaded changeset ID for the workspace.
Source Control Operations
Checkout
Checks out the specified paths for editing.
CheckIn
Checks in the specified paths with a comment. Uses CheckinFlags.Full | CheckinFlags.ProcessSymlinks.
Add
Adds untracked paths to source control. Automatically adds private parent directories.
Change Detection
HasChanges
Returns true if the workspace has any changes matching the specified options.
GetChanges
Returns all changes matching the specified options, optionally filtered to a base path.
UndoAllChanges
Reverts all changes matching the specified options.
Link Management
CreateXlink
Creates a Plastic SCM cross-repository link. If a deleted xlink exists at the path, undoes the deletion instead.
ModifyXlink
Modifies an existing xlink. Throws InvalidOperationException if no xlink exists at the path.
CreateSymlink
Creates a filesystem symbolic link via the ln -s command.
RemoveLink
Removes an xlink or symlink at the specified path. For xlinks, uses Plastic API's DeleteControlled. For symlinks, deletes the directory. Also cleans up .meta files.
TryGetXlink / HasXlink / GetAllXlinks
Query xlinks in the workspace.
Constants
default_change_options
WorkspaceStatusOptions
FindAllControlledChanges | FindAllLocalChanges | FindPrivates
Common Pitfalls
CLI commands used for xlinks and symlinks CreateXlink, ModifyXlink, and CreateSymlink execute cm or ln commands via CmdRunner. These depend on the system having cm and ln available. On macOS, cm is resolved to /usr/local/bin/cm.
RemoveLink deletes from disk RemoveLink deletes the directory or xlink and its .meta file from the filesystem. This is irreversible without source control recovery.
GetChanges may be slow GetChanges queries the full workspace status. For large workspaces, this can be slow. Use the path parameter to limit the scope.
Link paths start with / Link path parameters in methods like CreateXlink, RemoveLink, and TryGetXlink expect paths with a leading / (matching the format used by Plastic SCM's xlink system). The leading / is stripped via [1..] when constructing filesystem paths.
UndoAllChanges is destructive UndoAllChanges reverts all changes matching the options — there is no confirmation dialog. Be careful with the default options, which include private (untracked) files.
See Also
Repository — the parent repository that owns workspaces
PlasticSCM — discovers workspaces
EngineModule — uses workspace for mounting
PlasticSCM Overview — subsystem overview
Last updated