Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / DevOps / TFS

TFS Backward Migration from (2012SP1SQL 2012 ENT) to (2010 SP1SQL 2008 R2 STD)

4.40/5 (3 votes)
14 Oct 2014MIT3 min read 7.9K   1  
Process for backward migration of code from TFS 2012 to TFS 2010

Introduction

This tip describes the process of performing backward migration of TFS code from TFS 2012 using SQL server 2012 Enterprise edition to TFS 2010 version using SQL server 2008 R2 Standard while keeping the changesets intact. TFS backward migration is not fully supported. I put this process together after a lot of trial and testing. This process was used by me in real time scenario, where during project handover we had to perform a backward migration to provide the project TFS code with changesets intact to the client support team.

Using the Process

The process has been described below in point format. I am assuming that the person using the below process has access to:

  1. Virtual machine hosting tool like Oracle VirtualBox
  2. Windows Server 2008 R2
  3. Visual Studio 2012 SP1 professional
  4. Visual Studio 2010 SP1 professional
  5. TFS Server 2012 SP1
  6. TFS Server 2010 SP1
  7. GIT-TF
  8. GIT
  9. SQL Server 2012 Enterprise edition
  10. SQL Server 2008 R2 Standard edition
  11. SQL backup file of TFS 2012 collection taken from SQL 2012 Enterprise edition

Setup Virtual Machine 1

  1. Software
    1. Windows Server 2008 R2
    2. TFS Server 2012 SP1
    3. SQL Server 2012 Enterprise edition
    4. Visual Studio 2012 SP1 professional
    5. GIT-TF
    6. GIT
  2. Steps performed
    1. Setup Virtual Machine using Windows Server 2008 R2
    2. Install all the remaining software listed in the same order.
    3. Create a new Collection with the same collection name as the project on the TFS server 2012 Sp1.
    4. Restore the SQL backup file for TFS 2012 collection to the database created in step ‘c’.
    5. After restore, check that the collection in TFS server contains the desired project.
    6. Open Command prompt. On command prompt, navigate to the path where GIT-TF is installed. Execute the below command to clone the collection into a GIT repository:
      1. git-tf clone <TFS Server with Collection Name> <Team Project Name> <Clone Folder name> --deep (to get all change sets)

        Image 1

    7. The GIT repository downloaded in the above step contains “changesets to commits” mapping to ensure consistency. Due to this, the GIT repository cannot be transferred to a new TFS server. To overcome this, perform a clone of the downloaded GIT repository using GIT tool. Navigate to the path where GIT is installed on command prompt. Execute the below command to clone the GIT repository.
      1. Initialize en empty GIT repository – git init <Path for the clone>
      2. git clone <Path of the main GIT repository> <Path for the clone>

      Image 2

    8. Transfer the above cloned GIT repository to Virtual Machine 2 inside the GIT-TF root folder.

Setup Virtual Machine 2

  1. Software:
    1. Windows Server 2008 R2
    2. TFS Server 2010 SP1
    3. SQL Server 2008 R2 Standard edition
    4. Visual Studio 2010 SP1 professional
    5. GIT-TF
  2. Steps performed
    1. Setup Virtual Machine using Windows Server 2008 R2
    2. Install all the remaining software listed in the same order.
    3. Create a new Collection with the same collection name as the project on the TFS server 2010 Sp1.
    4. Create a new Team project with the same project name using Visual Studio 2010.
    5. Map the Team Project to a local path and perform get latest. Delete any default files inside the team project and check-in. If not deleted, check-in to TFS from the cloned GIT repository will fail.
    6. Open Command Prompt. On command prompt, navigate to the root path where the cloned GIT repository is stored. Execute the below command to configure the TFS server collection for transfer to TFS:
      1. git-tf --force configure <TFS Server with Collection Name> <Team Project Name> --deep
    7. Execute the below command to perform the transfer to TFS:
      1. git-tf checkin --deep --no-lock
    8. Once the transfer to TFS is complete, take a backup of the collection from SQL Server 2008 R2 standard to be provided during handover.

There are 3 things to be noted shown in the below screenshots:

  1. The time on the change sets on the migrated TFS collection is modified to the current time.
  2. The ownership of the original edits is lost and the owner names for edits are replaced by the user performing the migration (in this case “Administrator”).
  3. The changeset numbers in the migrated TFS do not match the numbers in the original TFS.

Original TFS

Image 3

Migrated TFS

Image 4

History

  • 10th October, 2014: Initial version

License

This article, along with any associated source code and files, is licensed under The MIT License