Patchwork D5867: largefiles: use wrappedfunction() for match() override in overridecopy()

login
register
mail settings
Submitter phabricator
Date Feb. 6, 2019, 11:57 a.m.
Message ID <ed0fec8c301bf257caa1c0dd17fd5d14@localhost.localdomain>
Download mbox | patch
Permalink /patch/38478/
State Not Applicable
Headers show

Comments

phabricator - Feb. 6, 2019, 11:57 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9f11759fc5f5: largefiles: use wrappedfunction() for match() override in overridecopy() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5867?vs=13842&id=13847

REVISION DETAIL
  https://phab.mercurial-scm.org/D5867

AFFECTED FILES
  hgext/largefiles/overrides.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -652,7 +652,7 @@ 
         wlock = repo.wlock()
 
         manifest = repo[None].manifest()
-        def overridematch(ctx, pats=(), opts=None, globbed=False,
+        def overridematch(orig, ctx, pats=(), opts=None, globbed=False,
                 default='relpath', badfn=None):
             if opts is None:
                 opts = {}
@@ -664,7 +664,7 @@ 
                     newpats.append(pat.replace(lfutil.shortname, ''))
                 else:
                     newpats.append(pat)
-            match = oldmatch(ctx, newpats, opts, globbed, default, badfn=badfn)
+            match = orig(ctx, newpats, opts, globbed, default, badfn=badfn)
             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)]
@@ -678,7 +678,6 @@ 
                         None)
             m.matchfn = matchfn
             return m
-        oldmatch = installmatchfn(overridematch)
         listpats = []
         for pat in pats:
             if matchmod.patkind(pat) is not None:
@@ -696,7 +695,8 @@ 
                                   _('destination largefile already exists'))
             copiedfiles.append((src, dest))
             orig(src, dest, *args, **kwargs)
-        with extensions.wrappedfunction(util, 'copyfile', overridecopyfile):
+        with extensions.wrappedfunction(util, 'copyfile', overridecopyfile), \
+             extensions.wrappedfunction(scmutil, 'match', overridematch):
             result += orig(ui, repo, listpats, opts, rename)
 
         lfdirstate = lfutil.openlfdirstate(ui, repo)
@@ -727,7 +727,6 @@ 
         else:
             nolfiles = True
     finally:
-        restorematchfn()
         wlock.release()
 
     if nolfiles and nonormalfiles: