Mercurial > hg
comparison hgext/remotefilelog/remotefilelogserver.py @ 45552:10284ce3d5ed
scmutil: introduce function to check whether repo uses treemanifest or not
In an upcoming patch, I wanted to check whether current repo uses treemanifest
or not.
I looked for a function and found that at all places we manually check for the
requirement in repo requirements. I guess having a dedicated function for that
is much better.
Differential Revision: https://phab.mercurial-scm.org/D8981
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 01 Sep 2020 18:08:24 +0530 |
parents | 77b8588dd84e |
children | 89a2afe31e82 |
comparison
equal
deleted
inserted
replaced
45551:4c8d9b53b1c7 | 45552:10284ce3d5ed |
---|---|
21 context, | 21 context, |
22 error, | 22 error, |
23 extensions, | 23 extensions, |
24 match, | 24 match, |
25 pycompat, | 25 pycompat, |
26 requirements, | 26 scmutil, |
27 store, | 27 store, |
28 streamclone, | 28 streamclone, |
29 util, | 29 util, |
30 wireprotoserver, | 30 wireprotoserver, |
31 wireprototypes, | 31 wireprototypes, |
168 n = util.pconvert(fp[striplen:]) | 168 n = util.pconvert(fp[striplen:]) |
169 yield (store.decodedir(n), n, st.st_size) | 169 yield (store.decodedir(n), n, st.st_size) |
170 if kind == stat.S_IFDIR: | 170 if kind == stat.S_IFDIR: |
171 visit.append(fp) | 171 visit.append(fp) |
172 | 172 |
173 if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | 173 if scmutil.istreemanifest(repo): |
174 for (u, e, s) in repo.store.datafiles(): | 174 for (u, e, s) in repo.store.datafiles(): |
175 if u.startswith(b'meta/') and ( | 175 if u.startswith(b'meta/') and ( |
176 u.endswith(b'.i') or u.endswith(b'.d') | 176 u.endswith(b'.i') or u.endswith(b'.d') |
177 ): | 177 ): |
178 yield (u, e, s) | 178 yield (u, e, s) |