Hardlink to/from in-repository file?

Masklinn masklinn at masklinn.net
Thu Apr 10 14:00:33 UTC 2014


On 2014-04-10, at 15:39 , Mads Kiilerich <mads at kiilerich.com> wrote:

> On 04/10/2014 02:22 PM, Masklinn wrote:
>> As can be seen, after the update the inode of the in-repository file
>> has changed, and it's not linked to the out-of-repository file anymore.
>> 
>> I couldn't find anything when looking for inode or hardlink information
>> pertaining to mercurial (except that mercurial will create hardlinks
>> between local clones), is this behavior expected? Is there a way to
>> change it?
> 
> Yes, Mercurial will intentionally not write into files but remove the old file and create a new file with the new content.

Makes sense I guess.

Angel Ezquerra's suggestion to look at hooks (update on one side,
post-qpull and qpush on the other one) seems to work, so I'll go with
that.

Thanks to you both.

>  That will break hardlinks and that is in most cases the right thing to do. It is also a way to avoid problems on windows and other systems where files can be locked.

Wouldn't a locked file be impossible to remove?

> (Arguably it would be even better if Mercurial used atomic rename instead of remove + create.)
> 
> /Mads




More information about the Mercurial mailing list