Patchwork [07,of,12,misc,largefiles] largefiles: clarify installmatchfn documentation

login
register
mail settings
Submitter Mads Kiilerich
Date April 13, 2014, 4:59 p.m.
Message ID <8a8a773003f4c2d29fc5.1397408350@localhost.localdomain>
Download mbox | patch
Permalink /patch/4323/
State Accepted
Commit aa3d652ba1d574ab20778439fceee61749535112
Headers show

Comments

Mads Kiilerich - April 13, 2014, 4:59 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1397407543 -7200
#      Sun Apr 13 18:45:43 2014 +0200
# Node ID 8a8a773003f4c2d29fc558fa5f74e20d4d52033e
# Parent  7f7c85566142e478ceb91f24b2cc1d6e44a3022a
largefiles: clarify installmatchfn documentation

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -24,8 +24,7 @@  import basestore
 # -- Utility functions: commonly/repeatedly needed functionality ---------------
 
 def installnormalfilesmatchfn(manifest):
-    '''overrides scmutil.match so that the matcher it returns will ignore all
-    largefiles'''
+    '''installmatchfn with a matchfn that ignores all largefiles'''
     oldmatch = None # for the closure
     def overridematch(ctx, pats=[], opts={}, globbed=False,
             default='relpath'):
@@ -42,16 +41,18 @@  def installnormalfilesmatchfn(manifest):
     oldmatch = installmatchfn(overridematch)
 
 def installmatchfn(f):
+    '''monkey patch the scmutil module with a custom match function.
+    Warning: it is monkey patching the _module_ on runtime! Not thread safe!'''
     oldmatch = scmutil.match
     setattr(f, 'oldmatch', oldmatch)
     scmutil.match = f
     return oldmatch
 
 def restorematchfn():
-    '''restores scmutil.match to what it was before installnormalfilesmatchfn
+    '''restores scmutil.match to what it was before installmatchfn
     was called.  no-op if scmutil.match is its original function.
 
-    Note that n calls to installnormalfilesmatchfn will require n calls to
+    Note that n calls to installmatchfn will require n calls to
     restore matchfn to reverse'''
     scmutil.match = getattr(scmutil.match, 'oldmatch', scmutil.match)