comparison mercurial/scmutil.py @ 18626:b114e41c4df3

addremove: don't audit the path for paths already in the dirstate Now that dirstate.walk returns None for paths under symlink directories, addremove doesn't need to validate each path it sees to look for files under symlinks. On a large repository this brings addremove from 6.3 seconds down to 3.65 (42%) since addremove no longer has to stat every directory of every file to determine if the file is inside a symlink directory. I put it through our benchmark and see no perf hit to any other commands.
author Durham Goode <durham@fb.com>
date Tue, 05 Feb 2013 14:36:19 -0800
parents 4db216b1c154
children 4034b8d551b1
comparison
equal deleted inserted replaced
18625:2cbd27f4f3c4 18626:b114e41c4df3
750 m.bad = lambda x, y: rejected.append(x) 750 m.bad = lambda x, y: rejected.append(x)
751 751
752 ctx = repo[None] 752 ctx = repo[None]
753 walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False) 753 walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False)
754 for abs in sorted(walkresults): 754 for abs in sorted(walkresults):
755 good = audit_path.check(abs)
756
757 st = walkresults[abs] 755 st = walkresults[abs]
758 dstate = repo.dirstate[abs] 756 dstate = repo.dirstate[abs]
759 if good and dstate == '?': 757 if dstate == '?' and audit_path.check(abs):
760 unknown.append(abs) 758 unknown.append(abs)
761 if repo.ui.verbose or not m.exact(abs): 759 if repo.ui.verbose or not m.exact(abs):
762 rel = m.rel(abs) 760 rel = m.rel(abs)
763 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) 761 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
764 elif (dstate != 'r' and 762 elif (dstate != 'r' and (not st or
765 (not good or not st or
766 (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))): 763 (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))):
767 deleted.append(abs) 764 deleted.append(abs)
768 if repo.ui.verbose or not m.exact(abs): 765 if repo.ui.verbose or not m.exact(abs):
769 rel = m.rel(abs) 766 rel = m.rel(abs)
770 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) 767 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))