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