Sunday, July 18, 2010

Converting Perforce depots to Mercurial repositories with hg convert

Converting Perforce to Mercurial repositories is fast (4-5 seconds for a 500MB repository with 300 revisions).

You'll also want to start p4d and log into P4V before, so it caches credentials.

1. Setup your p4 client:
export P4PORT=localhost:1666
export P4CLIENT=your_client_here

2. Enable hg converter by adding to ~/.hgrc

3. Start p4d
./p4d &

4. Convert the depot:
You need to specify a revision. Look it up in the p4 client (depot-details-revision). @all might also work.
hg convert //depot/...@307 converted-perforce path/to/hg-repo

5. Look at the history
hg history

6. Look at diffs and history with a graphical tool. This should give you a better idea of branches and such.

7. Clone your repository
hg clone /path/to/hg-repo

8. Publish your repository via the web interface
hg serve

9. Browse around

Additional notes:
Keep an eye on: