viernes, 18 de septiembre de 2009

upgrading mercurial and closing branches

If you follow my blog (unlikely), you already know I've been reading about source version control alternatives.

At $work, we use mercurial, but we had a quite old mercurial version (0.9.5). At that time, mercurial wasn't able to close named branches, so when you opened a new branch, you had to carry that branch with you forever. It was not really suited for a-branch-per-feature workflow.

Since mercurial 1.2 though, we can close branches with a --close-branch flag when commiting.

First things first. Upgrading mercurial is not that easy (at least in Ubuntu 8.04)

There's a launchpad user that seems to upload mercurial builds, but I never figured out how to use launchpad. My damn ubuntu can't manage the gpg key or whatever.

Installing from source requires python-dev and python-setuptools. apt-get install them .

Then, you can easy_install Mercurial, and hopefully it'll work.......OOOOOPS, no :)

you see some warnings there, right?
***** failed to import extension hgext.hbisect: No module named hbisect**
ok, as root, go to /etc/mercurial/hgrc.d/hgext.rc and comment the line with

bisect=


After that, you'll have a working updated mercurial, but probably, your hg view command will disappear.

you can find hgk in the source mercurial package, in the contrib directory.

wget http://www.selenic.com/mercurial/release/mercurial-1.3.1.tar.gz
Just untargz, and move mercurial-1.3.1/contrib/hgk to anywhere in your path.

Now with mercurial 1.3.1, my workflow can follow a-branch-per-feature without problems.

hg branch checkSinglePond
echo "say 'hey! I'm a new feature' ; " >> foo.pl
hg commit -m "fin de feature"
hg up default
hg merge myNewFeature
hg up myNewFeature
hg commit --close-branch -m "closed"
That's what I did the first time, but well, I thought if I could close a branch when commiting real stuff. It only makes sense if later, we plan on merging.

hg branch BarFeature
echo "say 'bar' "; >> foo.pl
hg commit --close-branch -m "added and closed"
hg branches # only shows 'default'
hg up default
hg merge BarFeature
hg commit -m "I'm Tip, with BarFeature Merged after closing"
Here's a screenshot of the mess :)




I'll keep posting my findings about version control and how I keep modifying my workflow to fit its 'best practices' ¬¬ .

2 comentarios:

Arthur dijo...

You can check out hgview which is more complete than the "batteries included" hg view.

It's a rewrite using qt that offers a bunch of other functionnalities : hgview (latest version described here

raig dijo...

Thanks Arthur, I'll check it. It seems a good option to replace hg view.

Expect a post about hgview soon :)

Cheers