I am trying to write a Powershell script where I may need to checkout items into different workspaces. How can I specify in the tf command which workspace to use?
Your best option is to use the tfs workspace command and create a new 'temporary' workspace while your ps script executes.
This only requires you to know the tfs path, you can then map to a local folder and only work with the files you need. At the end of the script you can delete the workspace.
Tfs workspace command
http://msdn.microsoft.com/en-us/library/y901w7se(v=vs.100).aspx
Related
When I delete a file in the file system, TFS 2013 will correctly show it as still being in version control, but the file will not show as pending delete, and committing changes does not remove the file from the server. If I go to Source Code Explorer, the deleted file shows up as being on the server, but if I try to delete it, I get an error saying The item could not be found in your workspace, which is also correct, but I need to delete the file and I can't find any way to do it. I really do NOT want to have to download each file and manually delete it.
So, how can I get TFS to detect files that are no longer on the local file system and remove them from the server?
Note, my workspace is local, not server. Many sources say that TFS should detect local deletes in a local workspace, but this does not seem to be true, at least, it's not what I'm seeing.
Update: I know that my workspace is local because here's the TFS Workspaces window:
If the changes are not being detected then your workspace is currently configured as a Server Workspace and not a Local Workspace.
If you edit your workspace, click Advanced, and switch the workspace type to Local.
Note: You can check the configuration by looking for the hidden $tf folder in the root of your workspace...
Use /deletes with the tfs power tool: http://blogs.msdn.com/b/buckh/archive/2005/11/16/power-toy-tfpt-exe.aspx#Online
I want to be able to set up a semi automatic Build script to check out a specific commit from our TFS server to a non generic folder to then cause the code to be built and packaged to enable a release.
I understand how to use the command line, and can script it fine, but its how to create a temporary workspace that will not interfere with the existing workspace on the machine to check the code out into.
I will have to research how to build the solution as well from the commandline but that may not be as hard as this...
You can use the command line tool tf.exe to create a new workspace e.g.:
tf workspace /new workspace_name`;username /collection:http://myserver:8080/tfs/DefaultCollection
You can get work folder mappings by using a template when creating the new workspace. See the /template parameter on tf workspace. Or you can use the tf workfold /map command to create work folder mappings for the new workspace. When you're done, use tf workspace /delete to delete the workspace.
I need a batch script that uses tf to retrieve the directory structure for a label in TFS, something like the equivalent of svn export, while not messing up with my current working workspace.
This is what I managed to come up with:
tf workspace /new TemporaryWorkspace /noprompt
This will create a new workspace, but with the following working folder:
$/: C:\
(considering that I ran the command from C:)
This is not what I want, but "tf workspace /new" doesn't seem to allow specifying the mapping, so I ran this to remove the default mapping:
tf workfold /unmap $/ /workspace:TemporaryWorkspace
then this one to create my desired mapping.
tf workfold /workspace:TemporaryWorkspace /map $/Project/Path C:\Temp\Path
Change the current directory to the local working folder (I don't know of another way to select the current workspace)
PUSHD C:\Temp\Path
Now I can finally retrieve the label and do my stuff with it.
tf get /version:LMyBeautifulLabel
Now the clean up.
tf workspace /delete TemporaryWorkspace /noprompt
Go back
POPD
All these seems a bit too cumbersome for my humble purpose. Is there a simpler way?
Thanks.
Unfortunately, you will need to create a workspace with the proper working folder mappings and then run the get. There's no one-liner alias to set this up for you.
You may be able to get by with creating a longer-lived workspace with the proper working folder mappings that you need not delete, but certainly if you're using this workflow frequently but with different labels or in different locations, creating a new temporary workspace each time probably does make the most sense.
Your best solution here is to either create a command script that executes this workflow or use the little known script functionality of the tf command line client. You can run a tf script by using:
tf #<filename>
or simply using:
tf #
to read from standard input.
Is it possible to just say to TFS that I have a file (call it Version.txt) and I want it to be checked in at a location (say $/MyProject/MyVersionLocation) and not have any workspace setup for that location?
Something like (pretend Syntax):
tf.exe c:\Version.txt CheckIn $/MyProject/MyVersionLocation /WorkSpaceOverride
If so, how do you do it?
It is not possible to checkin a file without a workspace mapping for that path.
One option would be to use a combination of "tf workspace" and "tf workfold" to dynamically create a workspace before checking in.
For example:
tf workspace /collection:http://server:8080/tfs/Collection /new TempWorkspace /noprompt
tf workfold /collection:<server> /workspace:TempWorkspace /map $/MyProject/MyVersionLocation/Version.txt C:\Version.txt
When I rename my repository folder in Nautilus, Bazaar can't open it any longer. In All Commands, there is a renames command, but it's not what I want. Bazaar claims to have the best renaming, so in the other VCSs, is everything unrenameable? What's going on? How do I rename my repository folder?
Based on more info from https://answers.launchpad.net/bzr-explorer/+question/116976 you have colocated workspace and you want to rename it. Because colocated workspace uses trick with lightweight checkouts and the latter using absolute path to point on the real branch inside colocated workspace, you have to execute bzr colo-fixup command after rename of colocated workspace.
Use Bazaar's rename option.