This is a mirror of official site: http://jasper-net.blogspot.com/

Mercurial (hg) with Dropbox

| Thursday, May 13, 2010
I use Dropbox and Mercurial together so often now, and it's so freakin' awesome.

But just as I was setting up another repo, I realized that there was a slim possibility that there's programmers out there who don't use this trick. So they're still doing something crazy for source control, like trying to manage an SVN server, or a P4 server, or dealing with "only 1 private repo" restrictions, etc.

So... here it is, easy as pie. Or something that's easy, that isn't pie. Your Mom, etc.

First, sign up for Dropbox. (That's a referral link, you'll get an extra 250 meg on top of your free 2 gig if you use that instead of just going to the website).

Now, use Mercurial as normal. HgInit is a decent basic tutorial. You'll probably want to install hgtk on Linux, or TortoiseHg on Windows. But, just for example, here's the command line version:

~/myproj$ hg init
~/myproj$ hg addremove
~/myproj$ hg commit -m "initial commit"
Now you have revisions locally, which is nice enough, but that's just Mercurial. If your hard drive dies, you're hooped.

On the other hand, you didn't have to worry about servers or making depots, or backup, or other mucking around until you've spent at least a few hours on the exciting new "myproj" and you decide you'd rather not lose it.

So, what do you do? First, clone your repo into your Dropbox:

~$ cd ~/Dropbox
~/Dropbox$ hg clone ~/myproj ~/Dropbox/myproj-hg --noupdate

The syntax is hg clone <from> <to>. The --noupdate flag tell Mercurial to just store the repository data, not to check out a working copy. You're never going to work directly in the Dropbox directory, but instead use it as a "remote" where you push and pull to and from it. The only thing that will ever be in that directory is the .hg directory, and there's no user-serviceable parts in that particular one. That's why I renamed myproj to myproj-hg in the clone step, just so I remember that it's a Mercurial directory, and it's supposed to be "empty" (because the .hg will be hidden on Linux).

Read more: h4ck3r.net

Posted via email from jasper22's posterous

0 comments: