aaragon
aaragon

Reputation: 2402

Is it possible to track the contents of a file linked softly (ln -s) via mercurial?

I use mercurial in all my coding projects. I run into a problem now that I start a new project. I have a single file that I use for all projects. In my new project I have created a soft link to that file via ln -s. However, after I create the repository with hg init I can't track changes to the original file. Is there a way to do this with mercurial?

Upvotes: 2

Views: 66

Answers (1)

Raphaël Gomès
Raphaël Gomès

Reputation: 1028

Mercurial does not follow symlinks for security reasons. It is not publicly documented as far as I know, but the source code does have a few comments here and there about it.

https://www.mercurial-scm.org/repo/hg/file/33dbc9f785e7/mercurial/dirstate.py#l1082

if unknown:
    # unknown == True means we walked all dirs under the roots
    # that wasn't ignored, and everything that matched was stat'ed
    # and is already in results.
    # The rest must thus be ignored or under a symlink.
    audit_path = pathutil.pathauditor(self._root, cached=True)

    for nf in iter(visit):
        [...]
        else:
            # It's either missing or under a symlink directory
            # which we in this case report as missing
            results[nf] = None

Note that this part of the code is being rewritten by your truly and will change in the next few months, although the rule around symlinks will remain.

Upvotes: 5

Related Questions