Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 18558:eb95cf4e219d
addremove: only query dirstate once per path
Previously the addremove code queried the dirstate 4 times per path. Now it
only does so once. On a large repo this brings addremove from 9.5 seconds
to 8.35 seconds (12%).
author | Durham Goode <durham@fb.com> |
---|---|
date | Mon, 04 Feb 2013 14:01:40 -0800 |
parents | ac0c12123743 |
children | d1582dd6288e |
comparison
equal
deleted
inserted
replaced
18557:945ba91c5e16 | 18558:eb95cf4e219d |
---|---|
740 audit_path(abs) | 740 audit_path(abs) |
741 except (OSError, util.Abort): | 741 except (OSError, util.Abort): |
742 good = False | 742 good = False |
743 rel = m.rel(abs) | 743 rel = m.rel(abs) |
744 exact = m.exact(abs) | 744 exact = m.exact(abs) |
745 if good and abs not in repo.dirstate: | 745 |
746 dstate = repo.dirstate[abs] | |
747 if good and dstate == '?': | |
746 unknown.append(abs) | 748 unknown.append(abs) |
747 if repo.ui.verbose or not exact: | 749 if repo.ui.verbose or not exact: |
748 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) | 750 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
749 elif (repo.dirstate[abs] != 'r' and | 751 elif (dstate != 'r' and |
750 (not good or not os.path.lexists(target) or | 752 (not good or not os.path.lexists(target) or |
751 (os.path.isdir(target) and not os.path.islink(target)))): | 753 (os.path.isdir(target) and not os.path.islink(target)))): |
752 deleted.append(abs) | 754 deleted.append(abs) |
753 if repo.ui.verbose or not exact: | 755 if repo.ui.verbose or not exact: |
754 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) | 756 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
755 # for finding renames | 757 # for finding renames |
756 elif repo.dirstate[abs] == 'r': | 758 elif dstate == 'r': |
757 removed.append(abs) | 759 removed.append(abs) |
758 elif repo.dirstate[abs] == 'a': | 760 elif dstate == 'a': |
759 added.append(abs) | 761 added.append(abs) |
760 copies = {} | 762 copies = {} |
761 if similarity > 0: | 763 if similarity > 0: |
762 for old, new, score in similar.findrenames(repo, | 764 for old, new, score in similar.findrenames(repo, |
763 added + unknown, removed + deleted, similarity): | 765 added + unknown, removed + deleted, similarity): |