cleanup: reuse existing wctx variables instead of calling repo[None]
authorMartin von Zweigbergk <martinvonz@google.com>
Sat, 20 May 2017 22:27:52 -0700
changeset 32382 c87db79b9507
parent 32381 b9942bc6b292
child 32384 2e5a476b2e46
cleanup: reuse existing wctx variables instead of calling repo[None] Incidentally, this apparently means we load .hgsub one time less as well, which affects a test case.
hgext/largefiles/overrides.py
mercurial/cmdutil.py
tests/test-subrepo-missing.t
--- a/hgext/largefiles/overrides.py	Thu May 18 16:43:56 2017 -0400
+++ b/hgext/largefiles/overrides.py	Sat May 20 22:27:52 2017 -0700
@@ -119,7 +119,7 @@
     m = matcher
 
     wctx = repo[None]
-    for f in repo[None].walk(matchmod.badmatch(m, lambda x, y: None)):
+    for f in wctx.walk(matchmod.badmatch(m, lambda x, y: None)):
         exact = m.exact(f)
         lfile = lfutil.standin(f) in wctx
         nfile = f in wctx
--- a/mercurial/cmdutil.py	Thu May 18 16:43:56 2017 -0400
+++ b/mercurial/cmdutil.py	Sat May 20 22:27:52 2017 -0700
@@ -715,8 +715,8 @@
             badstates = '?'
         else:
             badstates = '?r'
-        m = scmutil.match(repo[None], [pat], opts, globbed=True)
-        for abs in repo[None].walk(m):
+        m = scmutil.match(wctx, [pat], opts, globbed=True)
+        for abs in wctx.walk(m):
             state = repo.dirstate[abs]
             rel = m.rel(abs)
             exact = m.exact(abs)
@@ -3049,7 +3049,7 @@
 
         if not m.always():
             matcher = matchmod.badmatch(m, lambda x, y: False)
-            for abs in repo[None].walk(matcher):
+            for abs in wctx.walk(matcher):
                 names[abs] = m.rel(abs), m.exact(abs)
 
             # walk target manifest to fill `names`
--- a/tests/test-subrepo-missing.t	Thu May 18 16:43:56 2017 -0400
+++ b/tests/test-subrepo-missing.t	Sat May 20 22:27:52 2017 -0700
@@ -34,7 +34,6 @@
   $ hg revert .hgsub
   warning: subrepo spec file '.hgsub' not found
   warning: subrepo spec file '.hgsub' not found
-  warning: subrepo spec file '.hgsub' not found
 
 delete .hgsubstate and revert it