user730075
user730075

Reputation:

How to store my binary assets with Mercurial?

I'm starting a game development project and my team and I will be using Mercurial for version control and I was wondering what a more appropriate way to store the binary assets for the game would be. Basically, I have 2 options:

  1. Mercurial 2.1 has the largefiles extension, but I don't know too much about it. It seems like it'll solve the 'repository bloat' problem but doesn't solve binary merge conflict issues.

  2. Keeping the binary assets in a SVN checkout, as a subrepo. This way we can lock files for editing and avoid merge conflicts, but I would really like to avoid having to use 2 version control systems (especially one that I don't really like that much).

Any insight/advice or other options I haven't thought of?

Upvotes: 4

Views: 2328

Answers (2)

Martin Geisler
Martin Geisler

Reputation: 73748

You're correct that the largefiles extension will avoid bloating the repository. What happens is that you only download the large files needed by the revision you're checking out. So if you have a 50 MB file and it has been edited radically 10 times, then the versions might take up 500 MB on the server. However, when you do hg update you only download the 50 MB version you need for that revision.

You're also correct that the largefiles extension doesn't help with merges. Infact, it skips the merge step completely and only prompts you like this:

largefile <some large file> has a merge conflict
keep (l)ocal or take (o)ther?

You don't get a chance to use the normal merge machinery.

To do locking, you could use the lock extension I wrote for a client. They wanted it for their documentation department where people would work with files that cannot be easily merged. It basically turns Mercurial into a centralized system similar to Subversion: locks are stored in a file in the central repository and client contact this repository when you run hg locks and before hg commit.

Upvotes: 1

Ry4an Brase
Ry4an Brase

Reputation: 78330

As you surmised large files will do what you need. For merging binaries you can set up a merge tool if one exists for your file type. Something like this:

[merge-tools]
mymergetool.priority = 100
mymergetool.premerge = False
mymergetool.args = $local $other $base -o $output
myimgmerge = SOME-PROGRAM-THAT-WILL-MERGE-IMAGES-FOR-YOU
[merge-patterns]
**.jpg = myimgmerge
**.exe = internal:fail

In general though, merging non-text things will always be a pain using a source control tool. Digital Asset Management applications exist to make that less painful, but they're not decentralized or very pleasant with which to work.

Upvotes: 1

Related Questions