comparison mercurial/context.py @ 41769:e9413a3be093

context: rewrite renamed() in terms of new copysource() where appropriate It's only the filectx for committed files that have the copy source's nodeid easily available; workingfilectx's and overlayfilectx's renamed() simply find the nodeid by looking in the changeset's p1's manifest. Differential Revision: https://phab.mercurial-scm.org/D6009
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 25 Mar 2018 21:28:30 -0700
parents 041d829575ed
children c7a843aa4b42
comparison
equal deleted inserted replaced
41768:041d829575ed 41769:e9413a3be093
1699 return workingctx(self._repo) 1699 return workingctx(self._repo)
1700 1700
1701 def data(self): 1701 def data(self):
1702 return self._repo.wread(self._path) 1702 return self._repo.wread(self._path)
1703 def renamed(self): 1703 def renamed(self):
1704 rp = self._repo.dirstate.copied(self._path) 1704 rp = self.copysource()
1705 if not rp: 1705 if not rp:
1706 return None 1706 return None
1707 return rp, self._changectx._parents[0]._manifest.get(rp, nullid) 1707 return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
1708 def copysource(self): 1708 def copysource(self):
1709 return self._repo.dirstate.copied(self._path) 1709 return self._repo.dirstate.copied(self._path)
2145 2145
2146 def lexists(self): 2146 def lexists(self):
2147 return self._parent.exists(self._path) 2147 return self._parent.exists(self._path)
2148 2148
2149 def renamed(self): 2149 def renamed(self):
2150 path = self._parent.copydata(self._path) 2150 path = self.copysource()
2151 if not path: 2151 if not path:
2152 return None 2152 return None
2153 return path, self._changectx._parents[0]._manifest.get(path, nullid) 2153 return path, self._changectx._parents[0]._manifest.get(path, nullid)
2154 2154
2155 def copysource(self): 2155 def copysource(self):