diff hgext/largefiles/reposetup.py @ 16586:ebd2ead59f1c stable

largefiles: fix "hg status dir" missing regular files (issue3421) largefiles status implementation attemps to rewrite the input match objects to match the "standins" as well as the regular files. When fixing the directories listed in match.files(), if there was related standin entry, it was kept and the original path discarded. But directories can appear both as regular and standin entries.
author Patrick Mezard <patrick@mezard.eu>
date Sun, 06 May 2012 13:14:58 +0200
parents 1ff42ee98446
children dcfc70aab372
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py	Sun May 06 10:36:32 2012 +0200
+++ b/hgext/largefiles/reposetup.py	Sun May 06 13:14:58 2012 +0200
@@ -136,13 +136,22 @@
 
                 # Create a copy of match that matches standins instead
                 # of largefiles.
-                def tostandin(file):
-                    if working:
-                        sf = lfutil.standin(file)
-                        dirstate = repo.dirstate
-                        if sf in dirstate or sf in dirstate.dirs():
-                            return sf
-                    return file
+                def tostandins(files):
+                    if not working:
+                        return files
+                    newfiles = []
+                    dirstate = repo.dirstate
+                    for f in files:
+                        sf = lfutil.standin(f)
+                        if sf in dirstate:
+                            newfiles.append(sf)
+                        elif sf in dirstate.dirs():
+                            # Directory entries could be regular or
+                            # standin, check both
+                            newfiles.extend((f, sf))
+                        else:
+                            newfiles.append(f)
+                    return newfiles
 
                 # Create a function that we can use to override what is
                 # normally the ignore matcher.  We've already checked
@@ -153,7 +162,7 @@
                     return False
 
                 m = copy.copy(match)
-                m._files = [tostandin(f) for f in m._files]
+                m._files = tostandins(m._files)
 
                 # Get ignored files here even if we weren't asked for them; we
                 # must use the result here for filtering later