Importing to hg from perforce with large binary files

Greg Ward greg-hg at gerg.ca
Thu Jan 27 08:55:29 CST 2011


On Wed, Jan 26, 2011 at 1:20 PM, Mark Mason <mason97123 at gmail.com> wrote:
> I'm trying to convert a p4 depot to Mercurial. The depot in question
> contains many large binary files, which I would like to handle under
> Mercurial with one of the big/binary file extensions.

I know nothing about Perforce and very little about bigfiles.
However, I do know a lot about conversion from CVS and I wrote the
bfiles extension as an alternative to bigfiles, so I'm not completely
clueless here.  ;-)

> So, I downloaded and enabled both the perfarce extension and the bigfiles
> extension, crossed my fingers and hoped that magically all the large files
> detected during the import would be automatically shuffled off to the large
> binaries directory, and ran something like:

*snort* while I appreciate your optimism, it is sadly misplaced.
Extensions generally depend only on core hg, not on each other.  And
it would very bad form for an extension included with hg to depend on
(or even know about) a third-party extension.  And in the realm of big
files, where there are 3 to 5 competing extensions on the market, it
would be very very bad form for hg convert to single one out for
special treatment.

You are almost certainly going to have to write some custom code for
your conversion to succeed.  Quite likely you will end up hacking the
Perforce converter, unless it was carefully designed to allow you to
hook into the conversion and override key parts.

In my experience converting a moderately large CVS repo with a few
hundred large binary files using cvs2hg and bfiles, I had to write
some custom code in my cvs2hg "config" file to detect large files and
make bfiles handle them.  I suspect you will have to do something
similar.

BTW, I strongly recommend that you check out the various competing big
file extensions.  bigfiles isn't perfect, nor is bfiles.  See also
"snap" and "kbfiles".  Pick one *before* you invest a lot of effort in
writing conversion code that knows about that particular extension's
way of handling big files.

Greg


More information about the Mercurial mailing list