This repo contains a docker image of p4-fusion.
You must have p4 locally installed, and have run p4trust
and p4login
previously. To use the mass-convert.sh
script you will need to have jq
installed.
First, set the following environment variables:
export P4PORT=""
export P4USER=""
export P4CLIENT=""
export P4TICKETS=""
export P4TRUST=""
export P4ENVIRO=""
Next, create a direcotry for the converted git repo:
mkdir bare-clones
Then, run the docker image with the following command:
docker run -it -u $(id -u):$(id -g) \
-e P4PORT=$P4PORT \
-e P4USER=$P4USER \
-e P4CLIENT=$P4CLIENT \
-v $(pwd)/bare-clones:/p4-fusion/bare-clones \
--mount type=bind,source="$P4TICKETS",target=/home/ubuntu/.p4tickets,readonly \
--mount type=bind,source="$P4TRUST",target=/home/ubuntu/.p4trust,readonly \
--mount type=bind,source="$P4ENVIRO",target=/home/ubuntu/.p4enviro,readonly \
ghcr.io/robandpdx/p4-fusion:latest \
/p4-fusion/build/p4-fusion/p4-fusion \
--path //gl-exporter/... \
--user "$P4USER" \
--port "$P4PORT" \
--client "$P4CLIENT" \
--src bare-clones/gl-exporter.git \
--networkThreads 20 \
--printBatch 100 \
--lookAhead 1000 \
--retries 10 \
--refresh 100 \
--includeBinaries true \
--branch main \
--branch release-1
If your local use is not ubuntu
you'll need to modify the bind mounts in the command above to match the expected home directory of your user inside the container.
For usage of the p4-fusion
command above, refer to the project's readme.
Included in this repository is a script, mass-convert.sh
, to mass convert multiple p4 depots to git. The script will read a config.json
file. This config file should have a list of depots with branches configured for each depot. See the sample config.json file and the structure should be pretty self explanetory.
After running mass-convert.sh
successfully, you should have git clones in the ./clones
directory that are ready to push up to GitHub. You may need to migrate binaries to LFS or remove binaries using git-filter-repo before pushing up to Github.