» Do it. Now.

Mercurial - Set location for temporary files when issuing "hg commit"

Background

We were trying to do some kind of autocommit feature, thus when modifying files on the filesystem, the changes should be automatically committed into a VCS. First we chose Git, which worked pretty fine. When trying to switch to Mercurial, we stumbled across some problems, which are still unsolved.

If you're curious, we used inotify like that:

inotifywait -m -r --exclude ^\./\.hg/.* -e close_write -e move -e create -e delete . 

Problem

When issuing hg commit -m 'bar', mercurial seems to create some temporary files inside the repo's root directory, which again will be captured by inotify triggering a nice rolling loop ;]

babacu:~# inotifywait -m -r --exclude ^\./\.hg/.* -e close_write -e move -e create -e delete . 
Setting up watches.  Beware: since -r was given, this may take a while! 
Watches established. 
 
>> touch foo 
./ CREATE foo 
./ CLOSE_WRITE,CLOSE foo 
 
>> hg add foo 
 
>> hg commit -m 'initial commit' 
./ CREATE i4Q6-P 
./ CLOSE_WRITE,CLOSE i4Q6-P 
./ DELETE i4Q6-P 
./ CREATE tmpjY7y9W 
./ DELETE tmpjY7y9W 
./ CREATE wFrOqb 
./ CLOSE_WRITE,CLOSE wFrOqb 
./ DELETE wFrOqb 
./ CREATE tmpQ6mBth 
./ DELETE tmpQ6mBth 
 
[...] on and on and on

Possible solutions

  • Find a way to let them be created elsewhere using some configuration setting or environment variable
  • Patch the code!
ideas/mercurial-set-location-for-temporary-files-when-issuing-hg-commit.txt · Last modified: 2010/03/05 15:15 by amo