From patchwork Tue Apr 2 21:52:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 6, V2] scmutil.addremove: remove redundant directory and symlink checks From: Siddharth Agarwal X-Patchwork-Id: 1249 Message-Id: <0ea7f5083797d6513b8b.1364939575@sid0x220> To: mercurial-devel@selenic.com Date: Tue, 02 Apr 2013 14:52:55 -0700 # HG changeset patch # User Siddharth Agarwal # Date 1364939374 25200 # Tue Apr 02 14:49:34 2013 -0700 # Node ID 0ea7f5083797d6513b8b8498c55fc7b64a752f23 # Parent 4535ebeae4e69079ed7e0eb1f61ecffe372671be scmutil.addremove: remove redundant directory and symlink checks dirstate.walk only does lstats and never returns stat objects for directories. On a large repository with 170,000 files, this speeds perfaddremove up from 2.40 seconds to 2.34. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -686,8 +686,7 @@ def addremove(repo, pats=[], opts={}, dr 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 st or - (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))): + elif dstate != 'r' and not st: deleted.append(abs) if repo.ui.verbose or not m.exact(abs): rel = m.rel(abs)