[PATCH 3 of 4] addremove: don't perform m.exact/rel until needed
Durham Goode
durham at fb.com
Mon Feb 4 21:20:48 CST 2013
# HG changeset patch
# User Durham Goode <durham at 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%).
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':
More information about the Mercurial-devel
mailing list