Show More
@@ -365,7 +365,7 b' def debugsparse(ui, repo, *pats, **opts)' | |||||
365 | _import(ui, repo, pats, opts, force=force) |
|
365 | _import(ui, repo, pats, opts, force=force) | |
366 |
|
366 | |||
367 | if clearrules: |
|
367 | if clearrules: | |
368 |
|
|
368 | sparse.clearrules(repo, force=force) | |
369 |
|
369 | |||
370 | if refresh: |
|
370 | if refresh: | |
371 | try: |
|
371 | try: | |
@@ -503,17 +503,6 b' def _import(ui, repo, files, opts, force' | |||||
503 | _verbose_output(ui, opts, profilecount, includecount, excludecount, |
|
503 | _verbose_output(ui, opts, profilecount, includecount, excludecount, | |
504 | *fcounts) |
|
504 | *fcounts) | |
505 |
|
505 | |||
506 | def _clear(ui, repo, files, force=False): |
|
|||
507 | with repo.wlock(): |
|
|||
508 | raw = repo.vfs.tryread('sparse') |
|
|||
509 | includes, excludes, profiles = sparse.parseconfig(ui, raw) |
|
|||
510 |
|
||||
511 | if includes or excludes: |
|
|||
512 | oldstatus = repo.status() |
|
|||
513 | oldsparsematch = sparse.matcher(repo) |
|
|||
514 | sparse.writeconfig(repo, set(), set(), profiles) |
|
|||
515 | sparse.refreshwdir(repo, oldstatus, oldsparsematch, force) |
|
|||
516 |
|
||||
517 | def _verbose_output(ui, opts, profilecount, includecount, excludecount, added, |
|
506 | def _verbose_output(ui, opts, profilecount, includecount, excludecount, added, | |
518 | dropped, lookup): |
|
507 | dropped, lookup): | |
519 | """Produce --verbose and templatable output |
|
508 | """Produce --verbose and templatable output |
@@ -494,3 +494,21 b' def aftercommit(repo, node):' | |||||
494 | refreshwdir(repo, origstatus, origsparsematch, force=True) |
|
494 | refreshwdir(repo, origstatus, origsparsematch, force=True) | |
495 |
|
495 | |||
496 | prunetemporaryincludes(repo) |
|
496 | prunetemporaryincludes(repo) | |
|
497 | ||||
|
498 | def clearrules(repo, force=False): | |||
|
499 | """Clears include/exclude rules from the sparse config. | |||
|
500 | ||||
|
501 | The remaining sparse config only has profiles, if defined. The working | |||
|
502 | directory is refreshed, as needed. | |||
|
503 | """ | |||
|
504 | with repo.wlock(): | |||
|
505 | raw = repo.vfs.tryread('sparse') | |||
|
506 | includes, excludes, profiles = parseconfig(repo.ui, raw) | |||
|
507 | ||||
|
508 | if not includes and not excludes: | |||
|
509 | return | |||
|
510 | ||||
|
511 | oldstatus = repo.status() | |||
|
512 | oldmatch = matcher(repo) | |||
|
513 | writeconfig(repo, set(), set(), profiles) | |||
|
514 | refreshwdir(repo, oldstatus, oldmatch, force=force) |
General Comments 0
You need to be logged in to leave comments.
Login now