From patchwork Mon Mar 27 01:53:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4,of,8] largefiles: avoid meaningless changectx looking up From: Katsunori FUJIWARA X-Patchwork-Id: 19724 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Mon, 27 Mar 2017 10:53:44 +0900 # HG changeset patch # User FUJIWARA Katsunori # Date 1490575475 -32400 # Mon Mar 27 09:44:35 2017 +0900 # Node ID d1347341abb3e026ef6aa751b1048ceef44b3991 # Parent 34114d49e2c514600ec7527d266cdef2ee22e249 largefiles: avoid meaningless changectx looking up Logically, "repo[ctx.node()]" should be equal to "ctx". In addition to it, this redundant code path is repeated "len(match.m_files)" times. diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -365,10 +365,9 @@ def overridelog(orig, ui, repo, *pats, * # support naming a directory on the command line with only # largefiles. The original directory is kept to support normal # files. - if standin in repo[ctx.node()]: + if standin in ctx: m._files[i] = standin - elif m._files[i] not in repo[ctx.node()] \ - and repo.wvfs.isdir(standin): + elif m._files[i] not in ctx and repo.wvfs.isdir(standin): m._files.append(standin) m._fileroots = set(m._files)