comparison mercurial/context.py @ 35725:2a7e777c9eed

write: add the possibility to pass keyword argument from batchget to vfs We are going to pass atomictemp keyword argument from merge.baychget to vfs.__call__. Update all the frames to accept **kwargs and pass it to the next function. Differential Revision: https://phab.mercurial-scm.org/D1881
author Boris Feld <boris.feld@octobus.net>
date Wed, 17 Jan 2018 16:52:13 +0100
parents 22c42bfbe7ab
children f61461d2bfd8 0a7c59a4c835
comparison
equal deleted inserted replaced
35724:853bf7d90804 35725:2a7e777c9eed
1960 1960
1961 def remove(self, ignoremissing=False): 1961 def remove(self, ignoremissing=False):
1962 """wraps unlink for a repo's working directory""" 1962 """wraps unlink for a repo's working directory"""
1963 self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing) 1963 self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing)
1964 1964
1965 def write(self, data, flags, backgroundclose=False): 1965 def write(self, data, flags, backgroundclose=False, **kwargs):
1966 """wraps repo.wwrite""" 1966 """wraps repo.wwrite"""
1967 self._repo.wwrite(self._path, data, flags, 1967 self._repo.wwrite(self._path, data, flags,
1968 backgroundclose=backgroundclose) 1968 backgroundclose=backgroundclose,
1969 **kwargs)
1969 1970
1970 def markcopied(self, src): 1971 def markcopied(self, src):
1971 """marks this file a copy of `src`""" 1972 """marks this file a copy of `src`"""
1972 if self._repo.dirstate[self._path] in "nma": 1973 if self._repo.dirstate[self._path] in "nma":
1973 self._repo.dirstate.copy(src, self._path) 1974 self._repo.dirstate.copy(src, self._path)
2147 " '%s/' is a folder in %s (containing %d " 2148 " '%s/' is a folder in %s (containing %d "
2148 "entries: %s)" 2149 "entries: %s)"
2149 % (path, path, self.p1(), len(matches), 2150 % (path, path, self.p1(), len(matches),
2150 ', '.join(matches.keys()))) 2151 ', '.join(matches.keys())))
2151 2152
2152 def write(self, path, data, flags=''): 2153 def write(self, path, data, flags='', **kwargs):
2153 if data is None: 2154 if data is None:
2154 raise error.ProgrammingError("data must be non-None") 2155 raise error.ProgrammingError("data must be non-None")
2155 self._auditconflicts(path) 2156 self._auditconflicts(path)
2156 self._markdirty(path, exists=True, data=data, date=util.makedate(), 2157 self._markdirty(path, exists=True, data=data, date=util.makedate(),
2157 flags=flags) 2158 flags=flags)
2325 return self._parent.flags(self._path) 2326 return self._parent.flags(self._path)
2326 2327
2327 def setflags(self, islink, isexec): 2328 def setflags(self, islink, isexec):
2328 return self._parent.setflags(self._path, islink, isexec) 2329 return self._parent.setflags(self._path, islink, isexec)
2329 2330
2330 def write(self, data, flags, backgroundclose=False): 2331 def write(self, data, flags, backgroundclose=False, **kwargs):
2331 return self._parent.write(self._path, data, flags) 2332 return self._parent.write(self._path, data, flags, **kwargs)
2332 2333
2333 def remove(self, ignoremissing=False): 2334 def remove(self, ignoremissing=False):
2334 return self._parent.remove(self._path) 2335 return self._parent.remove(self._path)
2335 2336
2336 def clearunknown(self): 2337 def clearunknown(self):
2572 def remove(self, ignoremissing=False): 2573 def remove(self, ignoremissing=False):
2573 """wraps unlink for a repo's working directory""" 2574 """wraps unlink for a repo's working directory"""
2574 # need to figure out what to do here 2575 # need to figure out what to do here
2575 del self._changectx[self._path] 2576 del self._changectx[self._path]
2576 2577
2577 def write(self, data, flags): 2578 def write(self, data, flags, **kwargs):
2578 """wraps repo.wwrite""" 2579 """wraps repo.wwrite"""
2579 self._data = data 2580 self._data = data
2580 2581
2581 class overlayfilectx(committablefilectx): 2582 class overlayfilectx(committablefilectx):
2582 """Like memfilectx but take an original filectx and optional parameters to 2583 """Like memfilectx but take an original filectx and optional parameters to
2781 return f.read() 2782 return f.read()
2782 2783
2783 def remove(self): 2784 def remove(self):
2784 util.unlink(self._path) 2785 util.unlink(self._path)
2785 2786
2786 def write(self, data, flags): 2787 def write(self, data, flags, **kwargs):
2787 assert not flags 2788 assert not flags
2788 with open(self._path, "w") as f: 2789 with open(self._path, "w") as f:
2789 f.write(data) 2790 f.write(data)