Patchwork [3,of,4] addremove: don't perform m.exact/rel until needed

login
register
mail settings
Submitter Durham Goode
Date Feb. 5, 2013, 3:20 a.m.
Message ID <1c47ffd98e0ee0ddccfe.1360034448@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/805/
State Accepted
Commit acf4a405e440a47e18ca23a0f5cc200a32a44717
Headers show

Comments

Durham Goode - Feb. 5, 2013, 3:20 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1360015809 28800
# Node ID 1c47ffd98e0ee0ddccfe339e2a28cf1841be52a4
# Parent  f8d0ae2b9805840a73f4c3e44d64043cf47691de
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%).
Bryan O'Sullivan - Feb. 5, 2013, 5:44 p.m.
On Mon, Feb 4, 2013 at 7:20 PM, Durham Goode <durham@fb.com> wrote:

> addremove: don't perform m.exact/rel until needed
>

First three patches are in crew, thanks.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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':