Add-WorkSpace
SYNOPSIS
Creates a TFS workspace based on the mappings provided.
SYNTAX
Add-WorkSpace [-mappings] <String[]> [-tfsUrl <String>] [-localSourcePath <String>] [-branch <String>] [-branchToken <String>] [-localPathToken <String>] [-force] [<CommonParameters>]
DESCRIPTION
This function is helpful when you hava a set of mappings in one workspace that you want to copy to either another location on disk, another machine or you want to change the server branch the the mappings are bound to.
PARAMETERS
Mappings
List of mappings to include in workspace. These can be piped from an existing workspace and you can use the BranchToken and LocalPathToken to replace new server and local path values to be used for this workspace.
TfsUrl
The TFS Collection URL to use for connecting to TFS
LocalSourcePath
Local path where the workspace mappings should be rooted to
Branch
Server path from which to root mappings
BranchToken (optional)
String in the server path of the Mappings to be replaced with the Branch parameter
LocalPathToken (optional)
String in the local path of the Mappings to be replaced with the LocalSourcePath parameter. The default is 'c:\'.
Force (optional)
If a wokspace already exists that was not created by BigGit then add these mappings to that workspace
EXAMPLE 1
Invoke-TF workfold /workspace:"SomeOtherWorkspace;Matt Wrock" | Add-workspace -tfsUrl http://myserver:8080/tfs -localSourcePath "c:\dev\src\" -localPathToken "c:\" -Branch $/my/branch -BranchToken $/original/branch
This will create a new workspace based on the mappings of SomeOtherWorkspace and replace server path mappings starting with $/original/branch with $/my/branch and replace local path mappings starting with c:\ with c:\dev\src\
EXAMPLE 2
Invoke-TF workfold /workspace:"SomeOtherWorkspace;Matt Wrock" | Add-workspace -tfsUrl http://myserver:8080/tfs -localSourcePath "c:\dev\src\" -localPathToken "c:\"
This will create a new workspace based on the mappings of SomeOtherWorkspace and replace local path mappings starting with c:\ with c:\dev\src\. The server paths will be copied from the original mappings.
EXAMPLE 3
Add-workspace -mappings " $/my/branch/folder1: c:\dev\src\folder1"," $/my/branch/folder2: c:\dev\src\folder2" -tfsUrl http://myserver:8080/tfs -localSourcePath "c:\dev\src\"
This will create a new workspace and use the mappings passed in as is since no token parameters were used.
NOTES
While this function may provide some value for use outside of typical Git-Ennlistment intentions, you should always use Add-VolitileEnlistment, Add-VolitileEnlistment and Add-PartialBranch to create your workspaces involved with BigGit RIs and FIs. These wrap this function and track the workspaces so that integrations back and forth between git and TFS will work.