You can use Perforce repositories with Sourcegraph by using the git p4 adapter, which creates an equivalent Git repository from a Perforce repository. Sourcegraph doesn’t yet support Perforce repositories natively.
Screenshot of using Sourcegraph for code navigation in a Perforce repository:
p4CLI configured to access your Perforce repository
git p4(see “Adding
git p4to an existing install”)
For each Perforce repository you want to use with Sourcegraph, follow these steps:
git p4 clone //DEPOT/[email protected](replace
//DEPOT/PATHwith the Perforce repository path).
cd PATHto enter the directory of the new local Git repository.
git remote add origin https://git-host.example.com/my/repo.git
git push -u origin master
To update the repository after new Perforce commits are made, run
git p4 sync && git push in the local repository directory. Sourcegraph does not yet automatically sync repositories from Perforce, so you must do this manually or script it yourself.
The repositories you created on your Git host are normal Git repositories, so you can add the repositories to Sourcegraph as you would any other Git repositories.
We intend to improve Sourcegraph’s Perforce support in the future. Please file an issue to help us prioritize any specific improvements you’d like to see.
[git-p4: depot-paths = "//guest/acme_org/myproject/": change = 12345].