Show More
@@ -397,6 +397,9 b' def debugsparse(ui, repo, **opts):' | |||
|
397 | 397 | if count > 1: |
|
398 | 398 | raise error.Abort(_(b"too many flags specified")) |
|
399 | 399 | |
|
400 | # enable sparse on repo even if the requirements is missing. | |
|
401 | repo._has_sparse = True | |
|
402 | ||
|
400 | 403 | if count == 0: |
|
401 | 404 | if repo.vfs.exists(b'sparse'): |
|
402 | 405 | ui.status(repo.vfs.read(b"sparse") + b"\n") |
@@ -452,3 +455,5 b' def debugsparse(ui, repo, **opts):' | |||
|
452 | 455 | ) |
|
453 | 456 | finally: |
|
454 | 457 | wlock.release() |
|
458 | ||
|
459 | del repo._has_sparse |
@@ -30,6 +30,16 b' from .utils import hashutil' | |||
|
30 | 30 | enabled = False |
|
31 | 31 | |
|
32 | 32 | |
|
33 | def use_sparse(repo): | |
|
34 | if getattr(repo, "_has_sparse", False): | |
|
35 | # When enabling sparse the first time we need it to be enabled before | |
|
36 | # actually enabling it. This hack could be avoided if the code was | |
|
37 | # improved further, however this is an improvement over the previously | |
|
38 | # existing global variable. | |
|
39 | return True | |
|
40 | return requirements.SPARSE_REQUIREMENT in repo.requirements | |
|
41 | ||
|
42 | ||
|
33 | 43 | def parseconfig(ui, raw, action): |
|
34 | 44 | """Parse sparse config file content. |
|
35 | 45 | |
@@ -114,7 +124,7 b' def patternsforrev(repo, rev):' | |||
|
114 | 124 | patterns. |
|
115 | 125 | """ |
|
116 | 126 | # Feature isn't enabled. No-op. |
|
117 |
if not |
|
|
127 | if not use_sparse(repo): | |
|
118 | 128 | return set(), set(), set() |
|
119 | 129 | |
|
120 | 130 | raw = repo.vfs.tryread(b'sparse') |
@@ -260,7 +270,7 b' def addtemporaryincludes(repo, additiona' | |||
|
260 | 270 | |
|
261 | 271 | |
|
262 | 272 | def prunetemporaryincludes(repo): |
|
263 |
if not |
|
|
273 | if not use_sparse(repo) or not repo.vfs.exists(b'tempsparse'): | |
|
264 | 274 | return |
|
265 | 275 | |
|
266 | 276 | s = repo.status() |
@@ -313,7 +323,7 b' def matcher(repo, revs=None, includetemp' | |||
|
313 | 323 | ``includetemp`` indicates whether to use the temporary sparse profile. |
|
314 | 324 | """ |
|
315 | 325 | # If sparse isn't enabled, sparse matcher matches everything. |
|
316 |
if not |
|
|
326 | if not use_sparse(repo): | |
|
317 | 327 | return matchmod.always() |
|
318 | 328 | |
|
319 | 329 | if not revs or revs == [None]: |
@@ -367,7 +377,7 b' def matcher(repo, revs=None, includetemp' | |||
|
367 | 377 | |
|
368 | 378 | def filterupdatesactions(repo, wctx, mctx, branchmerge, mresult): |
|
369 | 379 | """Filter updates to only lay out files that match the sparse rules.""" |
|
370 |
if not |
|
|
380 | if not use_sparse(repo): | |
|
371 | 381 | return |
|
372 | 382 | |
|
373 | 383 | oldrevs = [pctx.rev() for pctx in wctx.parents()] |
General Comments 0
You need to be logged in to leave comments.
Login now