Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
33303:8b571495d811 | 33304:3e1accab7447 |
---|---|
147 for e in sorted(excludes): | 147 for e in sorted(excludes): |
148 fh.write(e) | 148 fh.write(e) |
149 fh.write('\n') | 149 fh.write('\n') |
150 | 150 |
151 invalidatesignaturecache(repo) | 151 invalidatesignaturecache(repo) |
152 | |
153 def readtemporaryincludes(repo): | |
154 raw = repo.vfs.tryread('tempsparse') | |
155 if not raw: | |
156 return set() | |
157 | |
158 return set(raw.split('\n')) | |
159 | |
160 def writetemporaryincludes(repo, includes): | |
161 repo.vfs.write('tempsparse', '\n'.join(sorted(includes))) | |
162 invalidatesignaturecache(repo) | |
163 | |
164 def addtemporaryincludes(repo, additional): | |
165 includes = readtemporaryincludes(repo) | |
166 for i in additional: | |
167 includes.add(i) | |
168 writetemporaryincludes(repo, includes) |