comparison 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
comparison
equal deleted inserted replaced
16585:0c35bb01a119 16586:ebd2ead59f1c
134 match, listignored, listclean, 134 match, listignored, listclean,
135 listunknown, listsubrepos) 135 listunknown, listsubrepos)
136 136
137 # Create a copy of match that matches standins instead 137 # Create a copy of match that matches standins instead
138 # of largefiles. 138 # of largefiles.
139 def tostandin(file): 139 def tostandins(files):
140 if working: 140 if not working:
141 sf = lfutil.standin(file) 141 return files
142 dirstate = repo.dirstate 142 newfiles = []
143 if sf in dirstate or sf in dirstate.dirs(): 143 dirstate = repo.dirstate
144 return sf 144 for f in files:
145 return file 145 sf = lfutil.standin(f)
146 if sf in dirstate:
147 newfiles.append(sf)
148 elif sf in dirstate.dirs():
149 # Directory entries could be regular or
150 # standin, check both
151 newfiles.extend((f, sf))
152 else:
153 newfiles.append(f)
154 return newfiles
146 155
147 # Create a function that we can use to override what is 156 # Create a function that we can use to override what is
148 # normally the ignore matcher. We've already checked 157 # normally the ignore matcher. We've already checked
149 # for ignored files on the first dirstate walk, and 158 # for ignored files on the first dirstate walk, and
150 # unecessarily re-checking here causes a huge performance 159 # unecessarily re-checking here causes a huge performance
151 # hit because lfdirstate only knows about largefiles 160 # hit because lfdirstate only knows about largefiles
152 def _ignoreoverride(self): 161 def _ignoreoverride(self):
153 return False 162 return False
154 163
155 m = copy.copy(match) 164 m = copy.copy(match)
156 m._files = [tostandin(f) for f in m._files] 165 m._files = tostandins(m._files)
157 166
158 # Get ignored files here even if we weren't asked for them; we 167 # Get ignored files here even if we weren't asked for them; we
159 # must use the result here for filtering later 168 # must use the result here for filtering later
160 result = super(lfilesrepo, self).status(node1, node2, m, 169 result = super(lfilesrepo, self).status(node1, node2, m,
161 True, clean, unknown, listsubrepos) 170 True, clean, unknown, listsubrepos)