Maintaining Two Different Source Control Servers - tfs

We have been hired by a client who would like us to check in code to their Azure Devops Team Foundation Version Control server.
We have our own small team of developers that will work on this project and commit changes to our own TFVC server first. Once all check-ins are approved, we would then like to commit all of our changes to our client's TFVC server. We have been given a single login to their TFS system, so we would like to check in our code into their system using the single login that was provided to us. The client does not need to know the history of all of our own developer's work, we would like them to see our check in as a single author. We don't want to migrate, as this will be a common task for us.
What's the most straightforward way we could do this?

It is not possible to sync code on 2 different TFS server. Since you work in one workspace (command line and GUI) at a time. And a workspace cannot span servers.
The only workaround here is manually copy/past your code directly through windows file system. Finally check in code to your client's TFVC server.
The better solution is to convince your clients to use Git repositories instead of TFVC. There is a lot to win here! And you could migrate your sources with git-tfs with all history.

Related

TFS to TFS replication with complete data?

I have seen that, there are resources available to migrate complete content from TFS to VSTS. However, i have not seen any good thread talks about the possibilities of getting it done between one TFS instance (2017) to another of same instance (again TFS 2017) hosted in different server?
First, you should confirm one thing, do you need to use the original hardware and TFS deployment or not.
You could perform a move when you plan to discontinue use of the original hardware and TFS deployment. You could also perform a clone when you intend to continue using the original TFS instance.
Please take a look at Move or Clone Team Foundation Server from one hardware to another
Note: If you want to do a colne option, you need to reconfigure server IDs and remap databases.

Configure a backup schedule for Git version control with VSTS

I found articles on GIT back up and restore but I did not find any on Microsoft TFS Scheduled backup for GIT version control.
This document describes on how TFS's traditional versioning can be scheduled for automatic back up. Configure a backup schedule and plan for Team Foundation Server
However, I did not find any link where I can read that "GIT repository is also included in schedule". I am not a TFS expert and I do not have access to TFS server to verify in person. So any help is appreciated.
The tutorial you are refer which is Scheduled Backups tool. It' a build-in tool on the Scheduled Backups page in the TFS Administration console.
It' the whole database back up not only referring to source control, but also work items, pull requests, builds, test plans or anything else that the service offers.
As a limitation, you need both an administrator for TFS and a member of the SQL Server System Administrators group.
And no need to to verify in person, it's under SQL server, when you want to use the backup, just restore the database.
If you are actually using the online VSTS . For now there is no build-in tool and got a uservoice:
Provide a backup service for Visual Studio Team Services
https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/5339461-provide-a-backup-service-for-visual-studio-team-se
However if you just want a git repository(source code) back up, you could use some 3rd-party tool to achieve this:
We use the VSO Rest API to query our VSO account and get all the data
we need. Since in VSO you can only have one Team Project Collection,
we retrieve all the team projects of the default collection. Each of
these team projects can have multiple repositories that need to be
backed up. A folder is created for each team project and saved to a
location on disk that can be configured in the app.config. When the
team project folder is created, the task loops over each repository in
the team project and creates folders for each repository.
Source Link
You can also fork it on GitHub here. Certainly, you should also be able to use this for on-premise TFS also use the API, just need to change some part.
TFS is implemented the way to keep Git repositories in the SQL Server database, too. Thus, when you follow the instructions from the article you reference, the source code will also be included in the backup, no difference whether it is TFVC or Git.

Can I utilize two different versions of TFS to manage source code?

I am not familiar with TFS, however the scenario that I will be coming across is that I will have a branch of source code stored in Visual Studio Team Services (was TFS Online) and locally I will be running TFS 2008.
Would there be any issues pulling the code from Team Services and merging with TFS 2008?
You won't be able to bind the code (solution and projects) to 2 different TFS servers. If you're using the online version of TFS what reason would you have of also trying to store the code in a local repository?
You definitely won't be able to merge the code between the different servers. TFS is a centralized version control system and merge operations need to be handled and tracked by the server.
You could theoretically Manage the code in one of the TFS servers (i.e. have the solution bound to TFS online) and manually manage the code in the other server. However TFS 2008 only supports local workspaces which means that it will make files read only if they are not explicitly checked out. This will cause you no end of pain.
Even if you did it the other way round (made the local TFS server the "master") you will almost certainly create yourself a load of problems as TFS simply isn't designed to be used this way
Also TFS 2008 is pretty ancient and unsupported.
EDIT:
The typical TFS workflow is.
Create a development branch on the server.
"Get" the code to a local folder on your dev machine (called a workspace).
"Check out" the files you need to modify from your branch or "Add" new files as needed.
You should regularly "check in" files to your branch to make sure your changes are saved on the server.
When your changes are complete then "merge" the code from the development branch back to the Main branch.
The code is stored and versioned on the server, but your changes are made on your local machine. To interact with the server you use the Team Explorer plugin in Visual Studio. Modern version of Visual Studio have Team Explorer built in.
If you're using the online version of TFS then you'll want to use Visual Studio 2012 or above.
If you're planning on Forking the code and do not plan on committing your changes back to the server, then you're probably better off using something like Git. You could use Git-tf or Git-TFS to pull changes from TFS and then that would make merging a lot easier and you could use your local Git Repo to manage your own changes

Using Mercurial locally with TFS Team Foundation Version Control Server Workspace

At work we are using TFS Team Foundation Version Control (TFVC) and the workspace is a server workspace (very large codebase). The limitations of our setup are that files checked out are locked for edit by other people. Also there is a culture of not committing until work is complete etc as many change-sets complicate merging later.
I am in no position to change the global rules or culture. I would like to locally setup a mercurial (hg) repo on my local machine. The idea is that I can work on my local copy make as many checkins to hg. When I am done I would like to bundle my changes into one changeset and send it off to the TFS location (also on my local machine). Then immediately checkin the changes to TFS server.
That way to the outside world I appear to checkout and then immediately checkin all of my code, only briefly locking the files changed. But locally in hg I get the full ability to make small checkins and work without worrying about locking files out for edit.
Somehow chain two version control systems, giving me the flexibility of HG locally, but continue using the global TFVC for final checkins.
Any ideas on how this could be achieved?
You can use git-tf and the hg-git. This was an intentional design decision when we built git-tf that this was a supported scenario.
That said... this seems a bit... icky.
You may want to write a few shell scripts to make this workflow a little bit easier.
But even with that, it's hard to imagine troubleshooting this when something inevitably goes wrong.
TFS doesn't have Mercurial support, but apparently does have Git support.
You can use the hg-git plugin to access TFS this way.
More details about the lack of support:
https://hglabhq.com/blog/2014/1/17/mercurial-support-in-tfs-declined
https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3607357-add-mercurial-support-to-team-foundation-server

Where can I get large sample TFS repositories?

I'm building a tool to integrate with TFS and it needs to properly parse TFS logs (from the tf.exe history command) and checkout different revisions (again using tf.exe). It works great on the test TFS server I have, but I want to test it on a broad range of large repositories to make sure my parsing works properly.
I'd hoped to use Codeplex to get access to TFS repositories, but it seems you only get TFS access to Codeplex projects if you're a project member.
Are there any collections of open source code hosted on public TFS servers? Are there any other publicly available servers I could use for testing?
I would suggest using svn2tfs and choose any relatively active project on SourceForge. There are plenty of projects on SF to choose from that use SVN and not CVS. You might even get a bonus out of it and help the svn2tfs project work out any kinks.
Since you mention tf history command, I assume you want to collect/parse logs on the project's (and its files) history of checkins.
So in addition to large repository, you also need a good amount of history, am I right? If yes, then here's your set of problems:
Most projects on codeplex use Mercurial, not TFS. So even if you get access, you cannot use TFS with them.
As you mentioned, they require you to a be a member for you to access the source.
Even if you get access or find a public server (unlikely), you still would need good amount of history.
If I'm correct in my assumptions so far, here's the easiest (bit tedious though) way out:
Go to any large projects's such as Nuget or Wix
revisions
Download any old revision (go back as far as you want the history for). You can download zipped src files without being a member.
In your test server, checkin the code (src) to create the baseline.
Download the next revision.
Checkout files in your server and overwrite them with the newer revision's files.
While checkin, use the history.txt (sample) to create checkin comments
Repeat this process few times.
Voila!! You now have a large repository with lot of history!
Hope this helps.
Have you tried some of the larger projects on Codeplex?
http://www.codeplex.com
If you only need read access you should be able to play around with the various repositories.
I don't have a huge amount of tfs experience, but I would assume there are migration tools that let you ingest code repositories from other products (e.g svn or hit).
If so, you might want to find a svn/git repo for a sizable foss project, and try importing that.
"I'd hoped to use Codeplex to get access to TFS repositories, but it seems you only get TFS access to Codeplex projects if you're a project member."
This solution appears to be the general consensus amoung SO'rs. I've read some of the Codeplex TFS connection problem threads (you linked to below) and I hope the comments in this thread resolves the issue:
Connecting to Codeplex TFS as a Coordinator or Developer.
I'm wondering if you can use git-tfs project to import an existing Git project into TFS.
Download and install git-tfs
Create a new TFS project
Clone the TFS project to a Git project using git-tfs ("git tfs clone http://tfs:8080/tfs/DefaultCollection $/some_project")
Import a existing Git project of your choice into your fresh new Git project (I don't know the command but I think it's possible).
Use git-tfs to checkin to TFS Server ("git tfs checkintool")
=> Do it makes sense ? And works ?
For more information:
http://lostechies.com/jimmybogard/2011/09/20/git-workflows-with-git-tfs/

Resources