[PATCH 04 of 19 STABLE] largefiles: refactoring for file list generation to create new matcher

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Feb 27 04:46:29 CST 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1330335216 -32400
# Branch stable
# Node ID 658bc73648340b844c75c3fdd071747c0f27ba76
# Parent  9e4f862ec92fa665a609c01477f9641facb80834
largefiles: refactoring for file list generation to create new matcher

this patch avoids both repetition of STANDIN file name creation and
useless nest of STANDIN-nize for 'STANDIN pattern'.

diff -r 9e4f862ec92f -r 658bc7364834 hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py	Mon Feb 27 18:33:36 2012 +0900
+++ b/hgext/largefiles/reposetup.py	Mon Feb 27 18:33:36 2012 +0900
@@ -128,13 +128,6 @@
                                 match, listignored, listclean,
                                 listunknown, listsubrepos)
 
-                # Create a copy of match that matches standins instead
-                # of largefiles.
-                def tostandin(file):
-                    if inctx(lfutil.standin(file), ctx2):
-                        return lfutil.standin(file)
-                    return file
-
                 # Create a function that we can use to override what is
                 # normally the ignore matcher.  We've already checked
                 # for ignored files on the first dirstate walk, and
@@ -143,9 +136,17 @@
                 def _ignoreoverride(self):
                     return False
 
+                # Create a copy of match that matches standins instead
+                # of largefiles.
                 def filefn(files):
                     for f in files:
-                        yield tostandin(f)
+                        if not lfutil.isstandin(f):
+                            sf = lfutil.standin(f)
+                            if inctx(sf, ctx2):
+                                yield sf
+                                continue
+                        # not 'known largefile', or 'STANDIN direct' pattern
+                        yield f
                 m = match.convert(filefn)
 
                 # Get ignored files here even if we weren't asked for them; we


More information about the Mercurial-devel mailing list