comparison mercurial/sparse.py @ 33354:4695f1829045

sparse: move code for clearing rules to core This is a pretty straightforward port.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 08 Jul 2017 13:19:38 -0700
parents 160efb559f67
children 9087f9997f42
comparison
equal deleted inserted replaced
33353:160efb559f67 33354:4695f1829045
492 origstatus = repo.status() 492 origstatus = repo.status()
493 origsparsematch = matcher(repo) 493 origsparsematch = matcher(repo)
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)