Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 28088:19424f960bf5
checkunknown: audit path before checking if it's a file or link
Previously we would lstat the file to see if it was a file or a link before
attempting to process it. If the file happened to exist across a symlink, and if
that symlink was pointing to a network file system, that check could be very
expensive.
The new logic audit's the path to avoid symlinks before performing the lstat on
the file itself.
In our situation, this shaved 10 minutes off of certain hg updates.
300 files * (2 seconds - the network filesystem lookup time)
author | Durham Goode <durham@fb.com> |
---|---|
date | Thu, 11 Feb 2016 17:23:10 -0800 |
parents | e397b58c0563 |
children | d49793aac1ac |
comparison
equal
deleted
inserted
replaced
28087:0b7ce0b16d8a | 28088:19424f960bf5 |
---|---|
596 return config | 596 return config |
597 | 597 |
598 def _checkunknownfile(repo, wctx, mctx, f, f2=None): | 598 def _checkunknownfile(repo, wctx, mctx, f, f2=None): |
599 if f2 is None: | 599 if f2 is None: |
600 f2 = f | 600 f2 = f |
601 return (repo.wvfs.isfileorlink(f) | 601 return (repo.wvfs.audit.check(f) |
602 and repo.wvfs.audit.check(f) | 602 and repo.wvfs.isfileorlink(f) |
603 and repo.dirstate.normalize(f) not in repo.dirstate | 603 and repo.dirstate.normalize(f) not in repo.dirstate |
604 and mctx[f2].cmp(wctx[f])) | 604 and mctx[f2].cmp(wctx[f])) |
605 | 605 |
606 def _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce): | 606 def _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce): |
607 """ | 607 """ |