We have a TeamCity/Octopus setup that runs great for several projects.
A new client wants access to the source code during development. Is it possible to copy code from our TFS to an other TFS using TeamCity? It does not need to be real-time. Daily copies are OK.
Not sure if we should use TeamCity for this or if there are possibilities within TFS itself.
You could setup a daily build schedule and use the TFS command line utilities to transfer the files to another server. You'll probably get all kinds of sync issues along the way, unless you always take your own solution as the current situation.
Look at tf.exe, especially the workspace, workfold commands and add, delete, and optionally destroy. Complete the job with a tf checkin.
Process as follows:
Create a workspace on your source TFS server (or use the built-in workspace features in team city): tf workspace /new
Map the folders you want to share: tf workfold /map
Get the files to the machine that's doing the transfer: tf get /recursive
Create a workspace on your target TFS server: tf workspace /new
Map the folders you want to share to tf workfold /map to a new folder that's not mapped to the source TFS server.
WS2 delete the files in the target folder: tf delete * /recursive
WS2 Check in to make sure you won't get any conflict remotely: tf checkin /recursive
WS1 -> WS2 Copy the files from the first workspace to the second: xcopy
WS2 Add all files: tf add * /recursive
WS2 Checkin all files tf checkin * /recursive
WS2 & WS2 Delete the workspace: tf workspace /delete
(Optional) Delete the files in the folders of the deleted workspaces on disk.
PS: if you move to git, this all becomes a lot easier, since the distributed nature of git is kind of meant for scenarios like these.
Related
I have this example where FolderA had sub FolderB and they were both folders, until I branched FolderB to FolderB-branch. Then both sub folder turned into branches.
How can I use tf command to determine what is folder and what is branch?
tf dir /r and tf dir /r /folders show the same info.
How can I use tf command to distinguish what is what?
TFS 11, Visual Studio 2012.
There is a way do this, using tf branches command. When using it, TFS returns 2 responses:
when item is a Folder:
Item FolderA is not used in any branch view
when item is a Branch, it lists branch tree, like:
../FolderB
>> ../FolderB-branch
Now we can parse the output and assign if item is a Folder or a Branch.
Of course, the command tf branches need to be run in parent folder or with full parameters like /collection and others, if required.
I'm trying to get latest on Visual Studio 2017/Angular project on a another machine and hence getting latest all files. It is taking a long time to 'Overwrite local file or folder' individually. Isn't there a way to Overwrite All local files or folders with single click?
In Visual Studio, from the Source Control Explorer, open the folder you want to overwrite. Use Advanced..., Get Specific Version...
And check the option "Overwrite writable files..."
Optionally check "Overwrite all files", but that should not be required and can take up more time.
You can also do this from the commandline:
tf vc get $/project/path /recursive /overwrite /version:T
And optionally to overwrite all files even if your system thinks they are unchanged:
tf vc get $/project/path /recursive /overwrite /force /version:T
Alternatively, you can use undo pending changes to revert to the last checked-in version, or scorch to clear files that aren't even checked in:
tf vc undo /recursive $/Project/path
and
tf vc scorch /recursive $/project/path
I have a problem with Jenkins building my source code. I'm using a lib repo and a repo for my code. I want Jenkins to build the project if anything in one of the repos changes.
Does anyone has some pointer how to solve this? I managed to get it working in the case that everything is in only one repo, but I want to separate the lib and the project code.
Unfortunately,the TFS pluging for Jenkins currently does not support checking out the sources from multiple locations.
However, as a work around you could use the command line to create any sort of workspace that you like, and even copy a template workspace that you have lying around.
To achieved this use both TF and the powershell Snapin Microsoft.TeamFoundation.PowerShell.
Basically the workflow is as follows :
Get-TFsWorkspace (Powershell : To check for the workspace)
TF Workspace /new (To Create a workspace)
TF Workfold /unmap (use this to remove the default $/ mapping which is
made during workspace creation)
TF Workfold /map (To map specific locations, ie $/Repo/project)
TF Scorch (to remove any artifacts if there are any)
TF Get (To get the code)
More details please refer this answer in a similar question.
Using Tf.exe by command line, how do I make the checkin of deleted files?
example:
Step 1:
My workfolder contains: file1.txt, file2.txt, file3.txt
TFS contains: file1.txt, file2.txt, file3.txt
The two environments are aligned.
Step 2:
I delete file file1.txt from Workfolder and then I checkin all with command tf checkin /recursive /noprompt but the file File1.txt is not deleted from tfs
If the manual delete outside of Visual Studio and the context of TFS then you are likely using a Server Workspace.
In server workspaces you need to do all operations against TFS. You should not be deleting from the disk directly.
To remove this issue you can switch to Local Workspaces that will auto detect deleted.
https://msdn.microsoft.com/en-us/library/bb892960.aspx
I need a way to force a branch in TFS to update itself to exactly match what is in the working folders. I need something that will delete files that are on the server but not in the working folders, add files to the server that are only in the working folders, and update the changed files by using the exact version that is in the working folders. I need this to be form the command line or the API’s and not a manually in the UI.
Does anyone know of any way to do this?
tf undo $/ /r
tfpt online /adds /deletes /diff /noprompt
tf checkin /comment:"synchronizing" /noprompt
Get tfpt here if you don't have it already: http://msdn.microsoft.com/en-us/teamsystem/bb980963.aspx