comparison mercurial/scmutil.py @ 18560:acf4a405e440

addremove: don't perform m.exact/rel until needed Moves the m.exact and m.rel calls within the conditionals they are used in. On a large repo this brings addremove from 7.1 seconds down to 6.3 (13%).
author Durham Goode <durham@fb.com>
date Mon, 04 Feb 2013 14:10:09 -0800
parents d1582dd6288e
children 341868ef0cf6
comparison
equal deleted inserted replaced
18559:d1582dd6288e 18560:acf4a405e440
739 good = True 739 good = True
740 try: 740 try:
741 audit_path(abs) 741 audit_path(abs)
742 except (OSError, util.Abort): 742 except (OSError, util.Abort):
743 good = False 743 good = False
744 rel = m.rel(abs)
745 exact = m.exact(abs)
746 744
747 st = walkresults[abs] 745 st = walkresults[abs]
748 dstate = repo.dirstate[abs] 746 dstate = repo.dirstate[abs]
749 if good and dstate == '?': 747 if good and dstate == '?':
750 unknown.append(abs) 748 unknown.append(abs)
751 if repo.ui.verbose or not exact: 749 if repo.ui.verbose or not m.exact(abs):
750 rel = m.rel(abs)
752 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) 751 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
753 elif (dstate != 'r' and 752 elif (dstate != 'r' and
754 (not good or not st or 753 (not good or not st or
755 (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))): 754 (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))):
756 deleted.append(abs) 755 deleted.append(abs)
757 if repo.ui.verbose or not exact: 756 if repo.ui.verbose or not m.exact(abs):
757 rel = m.rel(abs)
758 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) 758 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
759 # for finding renames 759 # for finding renames
760 elif dstate == 'r': 760 elif dstate == 'r':
761 removed.append(abs) 761 removed.append(abs)
762 elif dstate == 'a': 762 elif dstate == 'a':