# V2 Perforce Migration Path

V2 starts in the Oshun Git monorepo with Git LFS enforcing the Unreal binary
asset policy. When project scale requires Perforce, migrate only the Unreal
project subtree and keep source code mirrored from Git until the release
engineering owner cuts over the full workspace.

## Migration Boundary

- Git source: `V2/ue/`
- Perforce depot root: `//Oshun/V2`
- Initial import path: `//Oshun/V2/main/V2/ue/...`
- Git attributes source of truth before migration:
  [V2/ue/.gitattributes](../ue/.gitattributes) and root
  [`.gitattributes`](../../.gitattributes)
- Perforce ignore file after migration: [V2/ue/.p4ignore](../ue/.p4ignore)

## Stream Layout

Use streams so binary assets, cooked-release branches, and integration work have
predictable ownership:

```text
//Oshun/V2/main       mainline stream, protected release candidate source
//Oshun/V2/dev        development stream for daily integration
//Oshun/V2/release    release stream cut from main for certification fixes
//Oshun/V2/art        task stream for large asset drops and vendor ingest
//Oshun/V2/cinematics task stream for Sequencer, audio, and mocap integration
```

Required stream options:

- `main` is the only stream allowed to feed BuildGraph release jobs.
- `dev` integrates from `main` daily and copies up after validation.
- `art` and `cinematics` are task streams with short-lived ownership windows.
- Stream views include `V2/ue/...` and exclude monorepo package directories
  outside the Unreal project.

## Lock-Required Types

Use exclusive checkout for Unreal package files that are unsafe to merge:

- `*.uasset`
- `*.umap`
- `*.ubulk`
- `*.uexp`
- `*.utoc`
- `*.ucas`

These map to `binary+l`, matching the `lockable` Git LFS policy.

Use writable binary storage for source assets that can be replaced or reviewed
through their source tools:

- `*.fbx`
- `*.wav`
- `*.exr`
- `*.ktx2`
- `*.usd`
- `*.usdc`
- `*.usdz`

These map to `binary+w`.

## Typemap

Install this typemap before the first import:

```text
Typemap:
	binary+l //Oshun/V2/.../V2/ue/....uasset
	binary+l //Oshun/V2/.../V2/ue/....umap
	binary+l //Oshun/V2/.../V2/ue/....ubulk
	binary+l //Oshun/V2/.../V2/ue/....uexp
	binary+l //Oshun/V2/.../V2/ue/....utoc
	binary+l //Oshun/V2/.../V2/ue/....ucas
	binary+w //Oshun/V2/.../V2/ue/....fbx
	binary+w //Oshun/V2/.../V2/ue/....wav
	binary+w //Oshun/V2/.../V2/ue/....exr
	binary+w //Oshun/V2/.../V2/ue/....ktx2
	binary+w //Oshun/V2/.../V2/ue/....usd
	binary+w //Oshun/V2/.../V2/ue/....usdc
	binary+w //Oshun/V2/.../V2/ue/....usdz
	text     //Oshun/V2/.../V2/ue/....ini
	text     //Oshun/V2/.../V2/ue/....cs
	text     //Oshun/V2/.../V2/ue/....cpp
	text     //Oshun/V2/.../V2/ue/....h
	text     //Oshun/V2/.../V2/ue/....json
	text     //Oshun/V2/.../V2/ue/....uproject
```

## P4Ignore

Set `P4IGNORE=.p4ignore` for all V2 Perforce workspaces. The checked-in
`V2/ue/.p4ignore` excludes local Unreal output:

```text
Saved/...
Intermediate/...
Binaries/...
DerivedDataCache/...
.vs/...
*.sln
*.suo
*.xcodeproj/...
*.xcworkspace/...
Makefile
compile_commands.json
Saved/AutomationReports/...
Saved/Profiling/...
Saved/Logs/...
```

## Import Procedure

1. Freeze Git LFS writes to `V2/ue/Content` for the migration window.
2. Verify `python3 V2/ue/Tools/check-source-control-policy.py` and
   `python3 V2/ue/Tools/check-v2-source-control-lfs.py` pass on the Git tip.
3. Install the typemap, create streams, and set `P4IGNORE=.p4ignore`.
4. Import `V2/ue/...` into `//Oshun/V2/main/V2/ue/...`.
5. Run `p4 reconcile` and confirm package files open as `binary+l`.
6. Run the V2 BuildGraph editor compile and Win64 cook from the Perforce
   workspace before accepting the cutover.

## Validation

Run this validator from the Git repository root:

```bash
python3 V2/ue/Tools/check-v2-perforce-migration.py
```
