git-tf clone to DevOps - tfs

I'm trying to use git-tf to migrate some old TFVC projects from our local TFS to AzureDevOps (also a project with TFVC).
git-tf clone ... works
No I have the folder e.g. C:\TFSMigration\ProjectX
When I do git-tf checkin --deep the sourcecode is checked in in DevOps correctly but all files are in the parent-repository not in $DevOpsProjectWithTFVC/ProjectX
Here is my config:
collection = https://myCompany.visualstudio.com
serverpath = $/DevOpsProjectWithTFVC

For this to work, you need a clean git clone of you original TFVC. Do the following:
git-tf clone <TFVC> <Branch> --deep from the original TFVC to a local git repo.
git clone <Local git repo> the local repo to a new folder in your local computer.
git-tf configure <Destine TFVC> --deep (Execute this inside the new folder cloned from the git repo)
git-tf checkin
The first clone you execute using git-tf is mapped to the original TFVC so you won't be able to push the changes from there.

Related

Azure DevOps - Moving TVCS Repo from one tenant to another - 2021

Before posting this question I have looked through all the similar ones. Finding no workable solution I am asking for help.
Thanks in advance!
I am trying to copy the repository from one tenant to another one using the following approach:
(done) Download the tool: Download Microsoft Git-TF for Visual Studio Team Foundation Server and Visual Studio Online from Official Microsoft Download Center
(done) Download Git-TF and Git-TFS (done with using git-tfs)
Clone an existing TFVC repo to my local machine as a Git repo using the Git-Tf tool: git-tf clone https://dev.azure.com/myorg/ "$/mysourceteamproject/mysourcebranch" --deep git-tf is no longer supported so I used git-tfs here. git-tfs clone https://dev.azure.com/myorg/ "$/mysourceteamproject/mysourcebranch" --deep
(done) Cd into the directory that the code was cloned into and push the local Git repo to any empty remote Git repo (this will be used as a temporary repo during the migration) git remote add origin https://user#dev.azure.com/myorg/anyteamproject/_git/tempgitrepo git push -u origin –all
(done with using git-tfs) Cloned the temporary Git repo to my local machine git-tfs clone https://user#dev.azure.com/myorg/anyteamproject/_git/tempgitrepo
(done ) Created an empty new folder “migrated” in the existing target TFVC repo (done with git-ft but from this step I am not sure it is a correct approach now) Cd into the directory that the code was cloned into, and run the configure command: git-tf configure https://dev.azure.com/myorg/ "$/mytargetteamproject/migrated" (here git-tf does not due to Basic Authentication issue as it is no longer supported. Using gif-tfs led to bootstrapping to the tenant we would like to copy from - to original )
Run the pull command to merge two repos does not work - git-tf pull leads to bootstrapping to the wrong tenant - git-tfs pull the steps below simply cannot be executed as the step 8 cannot be completed properly.
Run a basic git commit command git commit -a -m "merge commit"
Checkin to the TFVC repo git-tf checkin –deep --metadata
The question is - is there a way to move TVCS repo from one tenant to another TVCS tenant repo?
Finally, I managed - of cause not only me - to do migration.
Unfortunately, git-tfs could not be used as it works not as git-tf.
The main issue was Authorization step with using git-tf.
Using token name and token as user name and password accordingly helped a lot.
All the steps done can be seen below:
Install GIT, GIT-TF, Java
To clone source repository to local GIT
git-tf clone https://azerov:[source token]#dev.azure.com/OrganizationName "$/D365FOps_Learn02/Trunk" --deep
username: TestPatMigration (the name of the token)
password: [source token]
Create any remote GIT repository to push local cloned repo there
cd into cloned repo c:\users[curuser]\Trunk
git remote add origin
https://azerov:[git temporary target token]#dev.azure.com/OrganizationNameTarget/GitTemp02/_git/GitTemp02**
To push local cloned repo into temporary GIT repo
git push -u origin –-all
To clone temporary git repo to local machine
git clone https://azerov:[git temporary target token]#dev.azure.com/OrganizationNameTarget/GitTemp02/_git/GitTemp02
To configure the target TFVS Project to push local temporary GIT repo there
cd into c:\users\GitTemp2
git-tf configure https://azerov:[git temporary target token]#dev.azure.com/OrganizationNameTarget/ “$/D365FOps_learn02/Trunk”
git-tf pull
Username: PATMigration (the name of the target source token)
password: [git temporary target token]
git commit -a -m "merge commit"
git-tf checkin –-deep –-metadata

Clone GIT to TFS (AzureDevOps) with git-tfs

we have an local DevOps Server 2019 with our old projects and I am able to clone this projects with git-tfs to local Git repositories. Everything is fine. After that I can push this repositories to our AzureDevOps Git repositories. Everything ok.
Now we have some projects and colleagues who want to use TFVC for these special projects. So my idea was to clone these projects from local TFS to Git and then use git-tfs rcheckin to push it to our AzureDevOps project.
But when I use "git-fts rcheckin --remote azuretfs" I get "error: latest TFS commit should be parent of commits being checked in"
When I use "git-tfs checin --remote azuretfs" all files are uploaded to the AzureDevOps project but without the history.
So can anyone describe what I have to do?
Note: I don't want to use the MigrationTool offered by Microsoft because of to many erros during validation the templates of work items etc. (we dont use it...)
For those who are looking for the same:
With the 'old' git tf tool (https://archive.codeplex.com/?p=gittf) you can migrate old TFVC project to Azure DevOps(TVFC).
If you want to migrate old TFVC projects to AzureDevOps(GIT) you should use git tfs (http://git-tfs.com/)
What you could try without guarantee of success...
Note: As I said, you will be able to migrate the history from one branch only.
Create the folder/project in TFVC where you want to put the source code.
Migrate this folder with git tfs clone (to have a git commit with the git-tfs metadata required to rcheckin)
Add the already migrated history repo (let's call it RepoWithHistory) as a local remote in this new repository (let's call it NewRepo). And git fetch
Clean metadata for only the commit coming from RepoWithHistory with something looking like: git filter-branch -f --msg-filter "sed 's/^git-tfs-id:.*$//g'" -- --all. But be careful to keep the metadata on the commits coming from NewRepo.
Use git replace --graft <sha1_of_first_commit_of_RepoWithHistory> <sha1_of_last_commit_of_NewRepo> to graft the 2 histories (the history must be on top of the one from the new one)
Use git rcheckin --no-merge to migrate the history to TFVC (that will be long...)
I hope it will help.
PS: perhaps you should try to do it on a small subset of commits to be able to verify it will works before doing it in the real TFVC project.

Migrate TFS to TFS including changesets

I need to download entire project from TFS including changesets and need to add to another TFS server with all changeset details.
Is this possible in TFS?
Please help.
I made this done using git-tf and Powershell
I installed git-tf using the following link
https://chriskirby.net/blog/migrate-an-existing-project-from-tfs-to-github-with-changeset-history-intact
I cloned my existing TFS repo to Git,by using
git-tf clone https://myaccount.visualstudio.com/DefaultCollection
$/MyBigProject/MyMainBranch --deep
Inside the GIt folder there is a subfolder named .git,inside we can find a file git-tf.
Inside the file rename changeset to TFS.
To checkin GIT to TFS, configure the TFS folder where you need to copy the GIT. Folder must be empty.
change directorty to the GIT folder in powershell.
git-tf configure http://xxxxxxx:8080/tfs/DefaultCollection/
$/xxxxx/xxxx --force
git-tf checkin --deep --autosquash
Note:
Commit time will be the current time and for all changesets and author will be the person doing the operation.
To keep the author you can try
git-tf checkin --deep --autosquash --keep-author

Migrating source code from TFS to VSTS

I am trying to migrate Source code from TFS to VSTS. I tried git-tf command to migrate and was able to migrate successfully but i am not able to migrate the history. Can someone guide me on what i am doing wrong. Please note i am not migrating to GITVC but migrating to TFVC in Visual studio from On premise TFS server.
Steps are ...
git-tf clone http://onprimisetfsurl/ $/project project
git-tf clone http://Visualstudiotfvcurl/ $project project1
git pull project1 into project
git-tf checkin --deep
Look at OpsHub https://visualstudiogallery.msdn.microsoft.com/28a90a17-d00c-4660-b7ae-42d58315ccf2 since that is the one that was recommended by the VSTS manager https://blogs.msdn.microsoft.com/bharry/2014/05/14/migrating-on-premises-tfs-to-vs-online/
https://www.visualstudio.com/en-us/articles/adopting-vsts also covers other tools if that doesn't work for you.
Add "--deep" when you perform git-tf clone:
git-tf clone http://onprimisetfsurl/ $/project --deep
Add my steps for your reference:
git-tf clone http://tfsurl $/tfsproject --deep
Create a project "vstsproject" in VSTS.
Delete the "BuildProcessTemplates" folder in the vstsproject from web portal.
Create a new folder for vstsproject on local machine.
Run "git init" to set this folder to a git repository.
Pull the changes in tfsproject into the new created repo.
Run "git log" to make sure the history is correct.
git-tf configure https://vstsurl $/vstsproject --deep
git-tf checkin --deep

xcode 4.6 to commit source code to the TFS

I got a problem while using xcode 4.6 to commit source code to the TFS, i'm using git-tf
but i can't commit source to server. I have been cloned folder from server. Please help me.
Once you have cloned your code on TFS to local git repo you are ready to make changes. Once you do them use:
git commit -a -m "commnent"
Now you can check them in your TFS:
git tf checkin
All commits will be checked as one single changeset on TFS.

Resources