views:

1667

answers:

8

I have a Mercurial repository for a personal project, and I have been storing the master repository in my Dropbox for a few weeks now (something along this line; and I understand it's also possible with git).

The idea is that it serves both as a way to work with multiple machines and as a remote backup. I clone the repository and work on the non-Dropbox copy, and only push updates once in a while, the same way I would, I suppose, work with Bitbucket.

Can you think of any drawbacks to this idea, compared to using dedicating hosting (BitBucket in the case of Mercurial)? I know Bitbucket has free accounts for single users, which is great, but they are limited to 150M, which isn't a huge.

In particular, is it possible that Dropbox's sync process would corrupt the repository? I had to run hg recover once on the master repository, but it might be unrelated (and anyway it happily recovered). Does anyone have a bad experience with the idea? Does anyone have a longer good experience and can alleviate my worries? Does anyone have an opinion based on better understanding of the internals of these things?

edit: I added some clarifications to the questions. They are in italics.

+1  A: 

I'd expect problems if you try to access repository in the middle of the sync. It also seems to be a bit of overhead. You don't really need to sync over the stuff you sync. I have no idea how dropbox handles conflicts, but I doubt it can do it in an scm-aware way.

Michael Krelin - hacker
+3  A: 

I suppose that would probably work okay for personal projects on one or two machines, but really you're going to want to use professional hosting for multi member projects.

I have personally used BitBucket for some time and have been quite pleased... you can have one private project on the free account, too.

Factor Mystic
+1  A: 

+1 for bitbucket. It's free, and you get a single private repo with that free account (unlike github).

The drawback with the dropbox only solution is that if you do screw something up in the repo on your machine, that screwup will be copied out to bitbucket and replicated to every other place you've got the dropbox installed. Dropbox is very quick, so you won't be able to stop it from happening in time to prevent issues.

You lose the ability to decouple making changes to your repository with publishing those changes.

I do use dropbox to host a couple of repositories that I use on both my home and work machines, but those aren't the only copies of those repositories. There's also a bitbucket repo (as well as other people that have clones of them).

Ted Naleid
The idea is to use the dropbox copy as a "master" and to actually work with local clones. So dropbox isn't the only copy. Maybe I should edit it into the question.
Daphna Shezaf
if there is at least one clone/copy outside of the dropbox, it should work fine. I do this exact thing with some personal notes repos that get backed up nightly outside of dropbox.
Ted Naleid
A: 

I've been using Dropbox with git for personal projects for quite some time now, and I haven't had a single problem yet. Although, there are times you have to wait for Dropbox to sync. I think this can cause minor problems if there are more than a few people working on the same project, but for personal projects, I find Dropbox to be even better than GitHub, if only for the fact that pushing/pulling is faster.

As for pushing/pulling mid-sync, this will most probably cause problems, and it might even corrupt your repo, but if you're the only one working on the project, then you know exactly when Dropbox will sync.

Can Berk Güder
+18  A: 

I'd advise against it for the reasons stated above, but more strenuously stated. Both mercurial and git have their own protocols for moving changesets between repositories. These protocols are optimized/built for:

  • efficiency
  • consistency (never can you pull from a repo in a half-updated state)
  • hooks/triggers -- doing things on push/pull including quality (no tabs allowed, etc.) filters

When you just let a directory sync handle the keeping of the .hg (or .git) directories in sync then during that sync you've got a remote store that's in an inconsistent state and doesn't know it.

Additionally both hg and git have a separation of what's local-only and what's remote-okay within their disk state. They know what info to share (example: commited changesets) and what not to (example: current, local working directory parent revision).

In other answers folks are saying "you'll probably be fine" or "I've never had a problem" and that's likely true, but it's not guaranteed true, and revision control isn't a place to play the odds. Use the proper, better, safer, more efficient, more full featured synchronization protocol for your source control system.

Ry4an
+2  A: 

I've had problems with my Dropbox'ed repositories becoming corrupted. It doesn't happen all the time, but it happens often enough that I'm going to stop using Dropbox for this purpose.

That said, Dropbox is certainly cheaper than getting real hosting, so as long as you keep backups you may find it acceptable for personal projects.

Kristopher Johnson
+1 Dropbox seems to get confused when a lot of files get created and deleted in a short time, for example the lock files.
Aaron Digulla
A: 

I would not recommend using dropbox with mercurial, as I often see conflicted files between my Mac and Windows clients. Especially undo is affected, but I did experience conflicts with other files as well.

Regards Mirko

Mirko Friedenhagen
A: 

I am using it with Bazaar at the moment across 3 machines. However, I am the lone developer in any of the branches.

I used the init-repo --no-trees command to create the repository.

Archimedes Trajano