largefiles: revert override, install matchfn outside the try/except restoring it
authorMads Kiilerich <madski@unity3d.com>
Sun, 13 Apr 2014 18:45:43 +0200
changeset 21095 ec309395aa45
parent 21094 4643bfec2485
child 21096 a45ed365904a
largefiles: revert override, install matchfn outside the try/except restoring it
hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Sun Apr 28 13:18:25 2013 +0200
+++ b/hgext/largefiles/overrides.py	Sun Apr 13 18:45:43 2014 +0200
@@ -598,31 +598,30 @@
 
         oldstandins = lfutil.getstandinsstate(repo)
 
+        def overridematch(ctx, pats=[], opts={}, globbed=False,
+                default='relpath'):
+            match = oldmatch(ctx, pats, opts, globbed, default)
+            m = copy.copy(match)
+            def tostandin(f):
+                if lfutil.standin(f) in ctx:
+                    return lfutil.standin(f)
+                elif lfutil.standin(f) in repo[None]:
+                    return None
+                return f
+            m._files = [tostandin(f) for f in m._files]
+            m._files = [f for f in m._files if f is not None]
+            m._fmap = set(m._files)
+            m._always = False
+            origmatchfn = m.matchfn
+            def matchfn(f):
+                if lfutil.isstandin(f):
+                    return (origmatchfn(lfutil.splitstandin(f)) and
+                            (f in repo[None] or f in ctx))
+                return origmatchfn(f)
+            m.matchfn = matchfn
+            return m
+        oldmatch = installmatchfn(overridematch)
         try:
-            def overridematch(ctx, pats=[], opts={}, globbed=False,
-                    default='relpath'):
-                match = oldmatch(ctx, pats, opts, globbed, default)
-                m = copy.copy(match)
-                def tostandin(f):
-                    if lfutil.standin(f) in ctx:
-                        return lfutil.standin(f)
-                    elif lfutil.standin(f) in repo[None]:
-                        return None
-                    return f
-                m._files = [tostandin(f) for f in m._files]
-                m._files = [f for f in m._files if f is not None]
-                m._fmap = set(m._files)
-                m._always = False
-                origmatchfn = m.matchfn
-                def matchfn(f):
-                    if lfutil.isstandin(f):
-                        return (origmatchfn(lfutil.splitstandin(f)) and
-                                (f in repo[None] or f in ctx))
-                    return origmatchfn(f)
-                m.matchfn = matchfn
-                return m
-            oldmatch = installmatchfn(overridematch)
-            overridematch(repo[None], pats, opts)
             orig(ui, repo, *pats, **opts)
         finally:
             restorematchfn()