Git -p4 - any great explanations of how this works

If you use perforce remotely and want to have amazing git speed to track differences, here is the solution: http://kb.perforce.com/article/1417/git-p4

However, I noticed the following:

  • Follow the instructions exactly.
  • It may take some time to import a large tree without getting a history
  • On a large tree, the first commit will take a long time, since this command will synchronize the entire tree.
  • If you commit, which you do not want to send, you need to execute "git rebase -i" and delete the offensive commit record. You cannot make "git p4 submit" and then "p4 return" a file that you do not want to send.
  • If you ruin something, things can get confused.

And that is my question. Is there a good explanation of how git-p4 uses remote repositories? And does the general explanation of hot git-p4 work?

git -p4 is not for the faint of heart. I teach that you really need to understand git well in order to use it well.

+6
source share
4 answers

Documentation/git-p4.txt has additional information in the git source code.

git -p4 supports the refs / remotes / p4 branch to mirror the remote Perforce server. By default, git-p4 clone and git-p4 sync update this remote and you reinstall it on it.

git-p4 submit requires setting up an additional local directory as the Perforce root client for use with p4 submit .

git-p4 sync/clone will write each list of Perforce changes in the corresponding git commit message. For instance:

[git-p4: depot-paths = "//depot/test/": change = 51]

Using these changes in change lists, git-p4 sync retrieves change lists on the Perforce server that are not yet attached to git, adding change list changes to each new git commit message.

git-p4 submit begins by defining new local git commits - without [git-p4: ...] . Using the local Perforce client workspace, it synchronizes the Perforce files, and with git apply applies the fixes received from git format-patch in the unconfirmed git declaration before calling p4 submit .

Then git-p4 submit calls git-p4 sync to update the ref / remotes / p4 branch against the newly updated remote Perforce.

Finally, git-p4 submit will invoke git rebase on the main branch on the updated remote. This leads to the same git tree that was sent, but with edited commit messages containing [git-p4...] entries in the change list.

How to save multiple files modified in git without sending them to p4?

git-p4 submit will send all the branches. Use the usual git tools to organize changes to and from the branch that you decide to submit to Perforce.

+8
source

Regarding "What commit are pending?"

Any command that can accept a range of changes (see gitrevisions (7) ) should work, you just need to refer to p4 remote as the endpoint for the range. For instance:

  • git log remotes/p4/master..master
  • git diff remotes/p4/master..master

I try to use show-branch to get a brief overview of the state of my branches, in which case git show-branch --all also works.

+2
source

I sometimes use git -p4, as I travel often and do not always have a good connection with the office. My understanding, although I did not go deep into this, is that git -p4 supports the Perforce workspace for you. Whenever you reboot git p4, you basically synchronize the code in your workspace, which git-p4 then repeats as new commits to your git repository. Whenever you do git p4 submit, it repeats a series of patches in your Perforce workspace and sends them using Perforce change lists.

I think you can think about it using the Perforce server as a remote branch, but realistically this is a very limited implementation of this.

If you have more detailed questions, I would try posting on the Perforce forums. There are several people in the office who have studied git-p4 in detail and could have helped.

+1
source

You might find this alternative tool interesting: http://lm1.imtqy.com/git-p4s

This is the fork of the original git-p4 utility with Perforce streaming support, but only one-way synchronization currently works.

-1
source

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


All Articles