Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a bi-directional bridge between p4 and git?

Tags:

git

perforce

Is there a good (reliable and automated) method for moving git changes between perforce and git for multiple users? git-p4 seems to handle the single user case well but I'm looking for a multi user option.

We are currently moving from many different source control systems to one; git. We may either need to move from git to perforce and provide a good way to showcase git to the perforce. For ether case a bi-direction bridge between the two will be essential.

Is there something out there that provides bidirectional traffic between git and p4 for multiple users?

like image 726
Peter Kahn Avatar asked Jun 24 '11 21:06

Peter Kahn


People also ask

What is the difference between P4 and Git branches?

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.

How do I interact with a P4 repository in Git?

This command provides a way to interact with p4 repositories using Git. Create a new Git repository from an existing p4 repository using git p4 clone, giving it one or more p4 depot paths. Incorporate new commits from p4 changes with git p4 sync. The sync command is also used to include new branches from other p4 depot paths.

How do I use perforce p4-integ with Git?

The sync command finds new changes in P4 and imports them as Git commits. We name the branch we'll use to directly interface with Perforce p4-integ. At this point we just want to branch it off remotes/p4/main: After the first import has been completed the subsequent git->p4 synchronizations can be done with the following commands:

How do I sync changes in Git P4?

Incorporate new commits from p4 changes with git p4 sync. The sync command is also used to include new branches from other p4 depot paths. Submit Git changes back to p4 using git p4 submit. The command git p4 rebase does a sync plus rebases the current branch onto the updated p4 remote branch.


3 Answers

Frankly, you're better off just migrating to Git, and perhaps checking in the git repository itself to perforce if you have a requirement for one reason or another to use perforce.

git <-> perforce bridges are problematic, especially in a distributed environment. Either have one person act as a gatemaster - or have each person sync with perforce individually and not with each other.

--------- UPDATED ---------------

It looks like Perforce has provided 'Perforce Fusion' - see http://www.perforce.com/product/components/git-fusion

This may be a workable solution, and they have a free trial.

like image 69
Arafangion Avatar answered Oct 20 '22 18:10

Arafangion


I have not heard of a solution. When faced with something like this, I usually go to a scripted solution and try not to bother bringing in the exact history. Usually anything marked as a release from the past 5 releases and all previous major releases. Keep the old repositories around in case you do need to look at a specific commit, but that's only on an as-needed basis.

Hope this helps a bit.

Good luck!

like image 1
Adam Dymitruk Avatar answered Oct 20 '22 17:10

Adam Dymitruk


I enhanced git-p4 so that it uses git notes (https://github.com/ermshiperete/git-p4). This has the advantage that the git repo can be shared by multiple people. However, it still doesn't allow complete automation because every developer has to submit his/her own changes to p4.

The way I set it up is that a script on the server checks if any new changes have been checked in to p4. If so it does a git-p4 sync and pushes the changes to the git repo (including the git-p4 notes). Developers working with git pull the master branch and the git-p4 notes branch from the git repo, make their changes and submit them to the local git repo. They then do a git p4 submit and afterwards push master + git-p4 notes branch to the remote git repo.

This works fairly well, although occasionally the server script checking p4 chokes - which I blame on my script. However, this is a band-aid solution and I hope we can move entirely to git soon.

like image 1
decocijo Avatar answered Oct 20 '22 17:10

decocijo