Mercurial > hg
diff mercurial/sparse.py @ 33304:3e1accab7447
sparse: move some temporary includes functions into core
Functions for reading and writing the tempsparse file have been
moved. prunetemporaryincludes() will be moved separately
because it is non-trivial.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 06 Jul 2017 14:48:16 -0700 |
parents | 8b571495d811 |
children | df1287268cc0 |
line wrap: on
line diff
--- a/mercurial/sparse.py Thu Jul 06 12:24:55 2017 -0700 +++ b/mercurial/sparse.py Thu Jul 06 14:48:16 2017 -0700 @@ -149,3 +149,20 @@ fh.write('\n') invalidatesignaturecache(repo) + +def readtemporaryincludes(repo): + raw = repo.vfs.tryread('tempsparse') + if not raw: + return set() + + return set(raw.split('\n')) + +def writetemporaryincludes(repo, includes): + repo.vfs.write('tempsparse', '\n'.join(sorted(includes))) + invalidatesignaturecache(repo) + +def addtemporaryincludes(repo, additional): + includes = readtemporaryincludes(repo) + for i in additional: + includes.add(i) + writetemporaryincludes(repo, includes)