changeset 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 37010a55922a
files mercurial/scmutil.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Mon Feb 04 14:06:20 2013 -0800
+++ b/mercurial/scmutil.py	Mon Feb 04 14:10:09 2013 -0800
@@ -741,20 +741,20 @@
             audit_path(abs)
         except (OSError, util.Abort):
             good = False
-        rel = m.rel(abs)
-        exact = m.exact(abs)
 
         st = walkresults[abs]
         dstate = repo.dirstate[abs]
         if good and dstate == '?':
             unknown.append(abs)
-            if repo.ui.verbose or not exact:
+            if repo.ui.verbose or not m.exact(abs):
+                rel = m.rel(abs)
                 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
         elif (dstate != 'r' and
               (not good or not st or
                (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))):
             deleted.append(abs)
-            if repo.ui.verbose or not exact:
+            if repo.ui.verbose or not m.exact(abs):
+                rel = m.rel(abs)
                 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
         # for finding renames
         elif dstate == 'r':