Git tfs branch --init - all errors

I have used https://stackoverflow.com/a/3126125/2128 to get tfs repo with branches in one git repository and it works fine for multiple branches. But I could not start all the branches because of:
"C:\tmp\Main>git tfs branch --init --authors=C:\tmp\authors-file.txt $/someproject/Branches/7.2.0 The name of the local branch will be : Branches/7.2.0 error: The root changeset 26907 have not be found in the Git repository. The branch containing the changeset should not have been created. Please do it before retrying!!"

or

C:\tmp\Main>git tfs branch --init --authors=C:\tmp\authors-file.txt $/someproject/Releases/7.0.0.1 The name of the local branch will be : Releases/7.0.0.1 An unexpected error occured when trying to find the root changeset. Failed to find root changeset for $/someproject/Releases/7.0.0.1 branch in $/someproject/Main branch C:\tmp\Main>git tfs branch --init --authors=C:\tmp\authors-file.txt $/someproject/Releases/7.0.0.1 The name of the local branch will be : Releases/7.0.0.1 An unexpected error occured when trying to find the root changeset. Failed to find root changeset for $/someproject/Releases/7.0.0.1 branch in $/someproject/Main branch (renamed branch problem: https://github.com/git-tfs/git-tfs/pull/299 )

TFS says 7.0.0.1 is a child branch of Main.

Environment: git-tfs version 0.17.1.0 (TFS client library 11.0.0.0 (MS)) (32-bit) C: \ Tools \ gittfs \ git -tfs.exe

Is there a solution for this?

+4
source share
3 answers

The problem is caused by renaming the branch. There is a problem for this here , but it has not yet been resolved.

init-branch does not handle renaming TFS branches

If I create a branch in TFS from my Trunk, then rename the branch when I try to execute init-branch on the renamed branch does not find the correct changeet and complains that the original does not exist in the Git repository

β€œIn TFS 2010, behind the scenes, renaming is actually a branch and the removal process, it meant that we ended up with a new branch, but also a remote branch of the old name. It's not obvious if you don't have 'Show deleted items in version control explorer enabled ... " the reason why git-tfs cannot handle this case is because git-tfs cannot initialize if the parent branch has not been entered before :( 2nd step of what I planned to do to better deal with merge sets and allow automatically initialization of the parent branch was not found during root typing (after merging # 363).

But he needs a lot of refactoring (you need to move many methods from one class to another) ...

+2
source

I found a workaround that allows you to clone all branches, even if they are renamed. As Adam mentioned, renamed branches are deleted and recreated, and we need β€œparent” commits that must be cloned in front of the children.

1) Find the list of all remote branches. I am using Visual Studio -> Source Control Explorer -> click the "Show hidden remote options" icon.

2) In ancestral order , git tfs branch --init $\Project\Branch_Location each remote branch

+1
source

Development designed to support branch renaming is now merged into master (but not yet released. Will be with the next version, which should be 0.21).

It should solve most cases of renaming (but with Tfs we are never sure :(). Do not hesitate to test and reporting case which do not work ...

+1
source

Source: https://habr.com/ru/post/1488290/


All Articles