D779: merge: add _checkunknowndirs function for detecting path conflicts

ryanmce (Ryan McElroy) phabricator at mercurial-scm.org
Thu Oct 5 12:28:35 EDT 2017


ryanmce accepted this revision.
ryanmce added a comment.


  Would love to see the comment added, but the code looks good to me.

INLINE COMMENTS

> mbthomas wrote in merge.py:654
> As in `_checkunknownfile`, this is to avoid symlink traversal while checking these files.
> 
> Consider:
> 
>   $ ln -s bar foo
>   $ hg add foo
>   $ hg up <some revision where foo is a directory containing directories>
> 
> When checking `foo/dir1/file1`, we will go through `foo` then `foo/dir1` in this loop.  The first case doesn't trigger the rule, as although `foo` is a link, it's in the dirstate, so should have been resolved by the merge.  The second loop will dereference `foo` and look at `bar/dir1`, which we don't want it to do.
> 
> Doing nothing is the right thing here - we will resolve the pathconflict via the merge resolution (there will be a `'pr'` action for this link).

This should be turned into a comment in the code. It's super useful to have this concrete example so future readers don't have the same question I did here.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D779

To: mbthomas, #hg-reviewers, ryanmce
Cc: ryanmce, mercurial-devel


More information about the Mercurial-devel mailing list