0

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?

brachi
  • 119
  • 1
  • 3
  • 16

2 Answers2

0

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.

Uday
  • 151
  • 1
  • 3
  • 15
  • This is not an answer to the question. The question is, really, about migrating from TFVC to Git. – Daniel Mann Jul 15 '20 at 14:33
  • 1
    Well, OP wants to migrate TFS projects from multiple collections into one collection. the commands posted points to Migration from TFVC to git and then git to TFVC. – Uday Jul 15 '20 at 14:57
  • At first thanks for your answer and yes you are right It's about migrating from TFVC to TFVC with the help of git, going from TFVC to Git is not what I asked and already know how to do. I will probably just move all my projects to GitLab and shutdown the TFS Server to use it differently. – brachi Jul 16 '20 at 05:31
  • I had the same requirement to migrate multiple TFVC repositories into a single collection. also, in case you are migrating the TFVC folder or project that contains documents then, it's going to be huge git repo post-migration. – Uday Jul 16 '20 at 16:53
0

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.

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28
  • Thanks for your answer and I will probably go to try that later but at first glance, it looks to me that it won't work because as far as I know, TFS 2013 doesn't support git repositories on the server. – brachi Jul 16 '20 at 05:38
  • 1
    @brachi. Thanks for correcting. Git-tfs doesn't support to migrate TFVC to TFVC. For a workaround, you could check the update. Please check if it could give you some help. – Kevin Lu-MSFT Jul 16 '20 at 07:27
  • Okay, thanks for the update I will have a look into that later that week and mark your answer as the solution if it works :) – brachi Jul 16 '20 at 08:06
  • @brachi Is there any update after the weekend? Feel free to let me know if the answer could give you some help. Thanks. – Kevin Lu-MSFT Jul 20 '20 at 09:32
  • Sorry for answering so late had some other projects going on. After trying your solution I get the same error as always with git-tf: ```git-tf: 'http://ip:8080/tfs/collection%20name/' is not a valid URL``` After using this command: ```git tf configure http://ip:8080/tfs/collection%20name/ $/project``` – brachi Jul 30 '20 at 12:23