comparison mercurial/context.py @ 34787:754b5117622f

context: add workingfilectx.markcopied With in-memory merge, copy information needs to be stored in-memory, not in the dirstate. To make this transition easy, move the existing dirstate-based approach to workingfilectx; that way, other implementations can choose to store it somewhere else. Differential Revision: https://phab.mercurial-scm.org/D1106
author Phil Cohen <phillco@fb.com>
date Sun, 15 Oct 2017 20:36:29 -0700
parents 0c812885586b
children 07bbb208a924
comparison
equal deleted inserted replaced
34786:9c899660700a 34787:754b5117622f
1933 def write(self, data, flags, backgroundclose=False): 1933 def write(self, data, flags, backgroundclose=False):
1934 """wraps repo.wwrite""" 1934 """wraps repo.wwrite"""
1935 self._repo.wwrite(self._path, data, flags, 1935 self._repo.wwrite(self._path, data, flags,
1936 backgroundclose=backgroundclose) 1936 backgroundclose=backgroundclose)
1937 1937
1938 def markcopied(self, src):
1939 """marks this file a copy of `src`"""
1940 if self._repo.dirstate[self._path] in "nma":
1941 self._repo.dirstate.copy(src, self._path)
1942
1938 def clearunknown(self): 1943 def clearunknown(self):
1939 """Removes conflicting items in the working directory so that 1944 """Removes conflicting items in the working directory so that
1940 ``write()`` can be called successfully. 1945 ``write()`` can be called successfully.
1941 """ 1946 """
1942 wvfs = self._repo.wvfs 1947 wvfs = self._repo.wvfs