Add a new function which, given a file name, finds the shortest path for which
there is a conflicting file or directory in the working directory.
Details
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
mercurial/merge.py | ||
---|---|---|
657 | Why do we need to audit this path first? If we fail the audit, what happens? This looks weird to me. |
mercurial/merge.py | ||
---|---|---|
657 | 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). |
Would love to see the comment added, but the code looks good to me.
mercurial/merge.py | ||
---|---|---|
657 | 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. |
Why do we need to audit this path first? If we fail the audit, what happens? This looks weird to me.