hard and soft links

Simon King simon at simonking.org.uk
Thu Nov 24 14:02:29 UTC 2016


On Thu, Nov 24, 2016 at 12:56 PM, Uwe Brauer <oub at mat.ucm.es> wrote:
> Hi
>
> I have a file called, say data.txt, which is located in
> /home/oub/dir1
> and is under HG control.
>
> Now I would like to use this file in a another dir
> /home/oub/dir2
> which is under HG as well. Moreover I push dir2 regularly to bitbucket.
>
> So I thought to use a hardlink between
>
> /home/oub/dir1/data.txt and
> /home/oub/dir2/data.txt
>
> However when I commit in /home/oub/dir2 the
> hardlink is destroyed.
> I hesitate to use a soft link.
>
> Could anybody suggest how to deal with this situation?

Which exact command is breaking the hard link? "hg commit" on its own
doesn't touch the working directory, so I doubt it's that. I just did
a small test with 2 repositories and a hardlinked file shared between
them, and I was able to edit and commit in either repository without
breaking the link.

However, when I reverted one of the repositories to an older revision
(via "hg update"), it *did* break the link. Is that the situation
that's causing you a problem?

Simon



More information about the Mercurial mailing list