Hardlink to/from in-repository file?

Masklinn masklinn at masklinn.net
Thu Apr 10 12:22:41 UTC 2014


I was trying to version a file between inside and outside of a
repository, but it looks like this does not work because mercurial
re-creates the file on each update:

> hg init test-link                                       
> cat > test-link/foo                                     
bar
^C
> hg -R test-link add test-link/foo                 
> hg -R test-link ci -m "0"                         
> cat >> test-link/foo                                    
baz
^C
> hg -R test-link ci -m "1"                         
> ln test-link/foo foo                                    
> cat foo                                                 
bar
baz
> ls -i test-link/foo foo                                 
36335311 foo           36335311 test-link/foo
> hg -R test-link up -r0                            
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> ls -i test-link/foo foo                                 
36335311 foo           36335421 test-link/foo

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?

Symlinks are not an option, as they're not transparent and mercurial
will version the link itself rather than the content (in my precise
case, "outside" is actually a different repository used solely for
MQ, as I prefer MQ's behavior to Quilt's)



More information about the Mercurial mailing list