changeset 15306:94527d67f3da stable

largefiles: fix some badly named function parameters overrides.py contains several functions that temporarily override scmutil.match(), which always takes a changectx object as the first parameter. But these overrides name that parameter either 'repo' or 'ctxorrepo', which is misleading. So rename them to 'ctx' and remove the special type-sensitive handling of the one called 'ctxorrepo'.
author Greg Ward <greg@gerg.ca>
date Sun, 16 Oct 2011 10:24:45 -0400
parents 683f417fa538
children 2bed4d0578a0
files hgext/largefiles/overrides.py
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Sun Oct 16 10:29:51 2011 -0400
+++ b/hgext/largefiles/overrides.py	Sun Oct 16 10:24:45 2011 -0400
@@ -24,9 +24,9 @@
     '''overrides scmutil.match so that the matcher it returns will ignore all
     largefiles'''
     oldmatch = None # for the closure
-    def override_match(repo, pats=[], opts={}, globbed=False,
+    def override_match(ctx, pats=[], opts={}, globbed=False,
             default='relpath'):
-        match = oldmatch(repo, pats, opts, globbed, default)
+        match = oldmatch(ctx, pats, opts, globbed, default)
         m = copy.copy(match)
         notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
                 manifest)
@@ -341,7 +341,7 @@
 
             manifest = repo[None].manifest()
             oldmatch = None # for the closure
-            def override_match(repo, pats=[], opts={}, globbed=False,
+            def override_match(ctx, pats=[], opts={}, globbed=False,
                     default='relpath'):
                 newpats = []
                 # The patterns were previously mangled to add the standin
@@ -351,7 +351,7 @@
                         newpats.append(pat.replace(lfutil.shortname, ''))
                     else:
                         newpats.append(pat)
-                match = oldmatch(repo, newpats, opts, globbed, default)
+                match = oldmatch(ctx, newpats, opts, globbed, default)
                 m = copy.copy(match)
                 lfile = lambda f: lfutil.standin(f) in manifest
                 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
@@ -443,16 +443,12 @@
         try:
             ctx = repo[opts.get('rev')]
             oldmatch = None # for the closure
-            def override_match(ctxorrepo, pats=[], opts={}, globbed=False,
+            def override_match(ctx, pats=[], opts={}, globbed=False,
                     default='relpath'):
-                if util.safehasattr(ctxorrepo, 'match'):
-                    ctx0 = ctxorrepo
-                else:
-                    ctx0 = ctxorrepo[None]
-                match = oldmatch(ctxorrepo, pats, opts, globbed, default)
+                match = oldmatch(ctx, pats, opts, globbed, default)
                 m = copy.copy(match)
                 def tostandin(f):
-                    if lfutil.standin(f) in ctx0 or lfutil.standin(f) in ctx:
+                    if lfutil.standin(f) in ctx or lfutil.standin(f) in ctx:
                         return lfutil.standin(f)
                     elif lfutil.standin(f) in repo[None]:
                         return None