Mercurial > hg
comparison hgext/remotefilelog/remotefilelogserver.py @ 46895:6085b7f1536d
store: also return some information about the type of file `walk` found
We start returning of 4th information in the `store.walk` return tuple: the type of the file. This will make it easier for caller to determine which kind of file they are looking at. This should especically help with the `upgrade-repo` code that has to do a lot of fragile index's file name comparison.
Differential Revision: https://phab.mercurial-scm.org/D10315
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 06 Apr 2021 10:38:03 +0200 |
parents | 89a2afe31e82 |
children | d55b71393907 |
comparison
equal
deleted
inserted
replaced
46894:fe34c75f62ab | 46895:6085b7f1536d |
---|---|
162 if kind == stat.S_IFREG: | 162 if kind == stat.S_IFREG: |
163 if not fp.endswith(b'.i') and not fp.endswith( | 163 if not fp.endswith(b'.i') and not fp.endswith( |
164 b'.d' | 164 b'.d' |
165 ): | 165 ): |
166 n = util.pconvert(fp[striplen:]) | 166 n = util.pconvert(fp[striplen:]) |
167 yield (store.decodedir(n), n, st.st_size) | 167 d = store.decodedir(n) |
168 t = store.FILETYPE_OTHER | |
169 yield (t, d, n, st.st_size) | |
168 if kind == stat.S_IFDIR: | 170 if kind == stat.S_IFDIR: |
169 visit.append(fp) | 171 visit.append(fp) |
170 | 172 |
171 if scmutil.istreemanifest(repo): | 173 if scmutil.istreemanifest(repo): |
172 for (u, e, s) in repo.store.datafiles(): | 174 for (t, u, e, s) in repo.store.datafiles(): |
173 if u.startswith(b'meta/') and ( | 175 if u.startswith(b'meta/') and ( |
174 u.endswith(b'.i') or u.endswith(b'.d') | 176 u.endswith(b'.i') or u.endswith(b'.d') |
175 ): | 177 ): |
176 yield (u, e, s) | 178 yield (t, u, e, s) |
177 | 179 |
178 # Return .d and .i files that do not match the shallow pattern | 180 # Return .d and .i files that do not match the shallow pattern |
179 match = state.match | 181 match = state.match |
180 if match and not match.always(): | 182 if match and not match.always(): |
181 for (u, e, s) in repo.store.datafiles(): | 183 for (t, u, e, s) in repo.store.datafiles(): |
182 f = u[5:-2] # trim data/... and .i/.d | 184 f = u[5:-2] # trim data/... and .i/.d |
183 if not state.match(f): | 185 if not state.match(f): |
184 yield (u, e, s) | 186 yield (t, u, e, s) |
185 | 187 |
186 for x in repo.store.topfiles(): | 188 for x in repo.store.topfiles(): |
187 if state.noflatmf and x[0][:11] == b'00manifest.': | 189 if state.noflatmf and x[0][:11] == b'00manifest.': |
188 continue | 190 continue |
189 yield x | 191 yield x |