Monday, November 22, 2010

Mercurial - behave like SVN?

I'm trying to use hooks to make mercurial behave like svn when committing. I like the idea that I can commit changes to my cloned repo while I'm away from the internet, but I never want that behavior when I do have internet access. Therefore, I want to attempt to pull before updating and attempt to push after committing. Every time. I have been consistently very unhappy with the hg merge command.


[hooks]
precommit = hg pull; hg up
postcommit= hg push
post-pull = hg up


However, this doesn't work. precommit freezes with the error
waiting for lock on working directory of [dir] held by [procnum]

and pre-commit results in other errors:

running hook pre-commit: hg pull; hg up
pulling from [source]
searching for changes
no changes found
running hook post-pull: hg up
abort: outstanding uncommitted merges
warning: post-pull hook exited with status 255
abort: outstanding uncommitted merges
warning: pre-commit hook exited with status 255


AG

1 comment:

Anonymous said...

This is how I did it:

pre-commit.pull_from_server = hg pull -u http://repos.yourdomain.com/beta_domain_com
pre-commit.pull_from_other = hg pull -u http://other-pc.yourdomain.com/beta_domain_com

I read somewhere on the internet that you have to use pre-commit and not precommit.

Regards

Andrew