--- a/hgext/sparse.py Thu Jul 06 12:24:55 2017 -0700
+++ b/hgext/sparse.py Thu Jul 06 14:48:16 2017 -0700
@@ -193,7 +193,7 @@
if len(temporaryfiles) > 0:
ui.status(_("temporarily included %d file(s) in the sparse checkout"
" for merging\n") % len(temporaryfiles))
- repo.addtemporaryincludes(temporaryfiles)
+ sparse.addtemporaryincludes(repo, temporaryfiles)
# Add the new files to the working copy so they can be merged, etc
actions = []
@@ -503,31 +503,13 @@
result = unionmatcher(matchers)
if kwargs.get('includetemp', True):
- tempincludes = self.gettemporaryincludes()
+ tempincludes = sparse.readtemporaryincludes(self)
result = forceincludematcher(result, tempincludes)
self._sparsematchercache[key] = result
return result
- def addtemporaryincludes(self, files):
- includes = self.gettemporaryincludes()
- for file in files:
- includes.add(file)
- self._writetemporaryincludes(includes)
-
- def gettemporaryincludes(self):
- existingtemp = set()
- raw = self.vfs.tryread('tempsparse')
- if raw:
- existingtemp.update(raw.split('\n'))
- return existingtemp
-
- def _writetemporaryincludes(self, includes):
- raw = '\n'.join(sorted(includes))
- self.vfs.write('tempsparse', raw)
- sparse.invalidatesignaturecache(self)
-
def prunetemporaryincludes(self):
if repo.vfs.exists('tempsparse'):
origstatus = self.status()
@@ -540,7 +522,7 @@
dirstate = self.dirstate
actions = []
dropped = []
- tempincludes = self.gettemporaryincludes()
+ tempincludes = sparse.readtemporaryincludes(self)
for file in tempincludes:
if file in dirstate and not sparsematch(file):
message = 'dropping temporarily included sparse files'
@@ -639,7 +621,7 @@
if count == 0:
if repo.vfs.exists('sparse'):
ui.status(repo.vfs.read("sparse") + "\n")
- temporaryincludes = repo.gettemporaryincludes()
+ temporaryincludes = sparse.readtemporaryincludes(repo)
if temporaryincludes:
ui.status(_("Temporarily Included Files (for merge/rebase):\n"))
ui.status(("\n".join(temporaryincludes) + "\n"))