Patchwork [4,of,8] largefiles: avoid meaningless changectx looking up

login
register
mail settings
Submitter Katsunori FUJIWARA
Date March 27, 2017, 1:53 a.m.
Message ID <d1347341abb3e026ef6a.1490579624@speaknoevil>
Download mbox | patch
Permalink /patch/19724/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - March 27, 2017, 1:53 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# 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.

Patch

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)