Is it possible to copy an TFS-Project folder from one collection to another

1.6k views Asked by At

I'm currently trying to migrate from TFS 2013 to GitLab. The problem is I want to keep some projects on my TFS server but get them all into one collection.

I don't want to copy a whole project from one collection to another, I want to copy a folder and keep the history. I already tried to just download the folder from the TFS server and check it in onto the other collection, that did work but the history was lost.

My second try was to use the git-tfs and git-tf tool following these instructions: https://fabiostawinski.wordpress.com/2017/03/22/tfvc-to-git-to-tfvc-is-it-possible/ but the git-tf tool is very outdated and I found no help for my problem so I gave up on it. (git-tf said that my TFS-URL was wrong even do it worked with git-tfs)

My other guess was to clone the folder from the TFS-Server with the git-tfs tool I used the following command to clone it as a local repository:

git tfs clone <tfs-address> <project-address>

As far as i know, there is the command git tfs rcheckin to checkin again on the tfs server. I added a new tfs remote pointing to the other collection:

git tfs init -i collection2 <tfs-address/target_collection> "<project-address>"

After that I tried to check in with the new remote added:

git tfs rcheckin --i=collection2

Unfortunately, I get this error (Debugging included)

Command run:git tfs rcheckin --i=default --d
No authors file used.
git-tfs version 0.31.0.0 (TFS client library 14.0.0.0 (MS)) (64-bit)
git command: Starting process: git --version
git command time: [00:00:00.0377481] --version
No TFS parents found!

So I wanted to ask if there is an easier way to do all of this or if I am just missing something?

2

There are 2 answers

4
Uday On

TFS checkin are stored in database with each checkin id is auto generated id for that collection. If you copy folder and add it manually, then new checkin id will be auto generated. So, its not possible to have move TFS folder with the history across collection.

5
Kevin Lu-MSFT On

Based on my test, when I run the same script, I could get the same error.

To migrate from TFVC to Git and keep the history, you could try the following steps:

Step1: Run the script: git tfs clone <TFS URL> $/project (The repo type is tfvc). Then you could clone the project and all history.

Step2: Run cd repo path to navigate to the local repo path and git checkout -b TempBranch to create a temp branch.

Step3: Run git remote add origin <Git URL> to set the target.

For example: git remote add origin http://dctfs2019:8080/tfs/Collection2017/Project1/_git/3 (The repo type is git)

Step4: Run git push --set-upstream origin TempBranch to push all repos to the temp branch.

enter image description here

Then the repo and history will be pushed successfully. You also could create a pull request to merge the tempbranch to the master branch.

Updates:

From this ticket:

Git-TFS: in no way it could be used to push this history to another empty TFVC project.

It couldn't directly migrate TFVC to TFVC.

After referring to your requirements, I suggest that you could use Git-TFS to migrate TFVC(TFS) to Git(Gitlab). You just need to change the target repo path in git command.

Then you could use Git-tf to migrate Git repo (Gitlab) to TFVC repo(TFS).

Here is a doc about migrate Git repo to TFVC repo.