Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   git-p4    ( 1 )

импорт из репозиториев Perforce и отправка в них (Import from and submit to Perforce repositories)

BRANCH DETECTION

P4 does not have the same concept of a branch as Git. Instead, p4
       organizes its content as a directory tree, where by convention
       different logical branches are in different locations in the
       tree. The p4 branch command is used to maintain mappings between
       different areas in the tree, and indicate related content. git p4
       can use these mappings to determine branch relationships.

If you have a repository where all the branches of interest exist as subdirectories of a single depot path, you can use --detect-branches when cloning or syncing to have git p4 automatically find subdirectories in p4, and to generate these as branches in Git.

For example, if the P4 repository structure is:

//depot/main/... //depot/branch1/...

And "p4 branch -o branch1" shows a View line that looks like:

//depot/main/... //depot/branch1/...

Then this git p4 clone command:

git p4 clone --detect-branches //depot@all

produces a separate branch in refs/remotes/p4/ for //depot/main, called master, and one for //depot/branch1 called depot/branch1.

However, it is not necessary to create branches in p4 to be able to use them like branches. Because it is difficult to infer branch relationships automatically, a Git configuration setting git-p4.branchList can be used to explicitly identify branch relationships. It is a list of "source:destination" pairs, like a simple p4 branch specification, where the "source" and "destination" are the path elements in the p4 repository. The example above relied on the presence of the p4 branch. Without p4 branches, the same result will occur with:

git init depot cd depot git config git-p4.branchList main:branch1 git p4 clone --detect-branches //depot@all .