comparison mercurial/context.py @ 41768:041d829575ed

context: add specialized way of getting copy source file only I'm working on support for storing copy metadata in the changeset instead of the filelog. I don't intend to include the file nodeid there, but most callers don't need that anyway. This patch introduces a method similar to ctx.renamed(), but the new method returns only the source filename, not the nodeid. Subsequent patches will move callers over to this new method. Differential Revision: https://phab.mercurial-scm.org/D6008
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 25 Mar 2018 21:32:16 -0700
parents cd7059d17cb2
children e9413a3be093
comparison
equal deleted inserted replaced
41767:1c1c4ef8b72e 41768:041d829575ed
689 return self._changectx.manifest() 689 return self._changectx.manifest()
690 def changectx(self): 690 def changectx(self):
691 return self._changectx 691 return self._changectx
692 def renamed(self): 692 def renamed(self):
693 return self._copied 693 return self._copied
694 def copysource(self):
695 return self._copied and self._copied[0]
694 def repo(self): 696 def repo(self):
695 return self._repo 697 return self._repo
696 def size(self): 698 def size(self):
697 return len(self.data()) 699 return len(self.data())
698 700
1701 def renamed(self): 1703 def renamed(self):
1702 rp = self._repo.dirstate.copied(self._path) 1704 rp = self._repo.dirstate.copied(self._path)
1703 if not rp: 1705 if not rp:
1704 return None 1706 return None
1705 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):
1709 return self._repo.dirstate.copied(self._path)
1706 1710
1707 def size(self): 1711 def size(self):
1708 return self._repo.wvfs.lstat(self._path).st_size 1712 return self._repo.wvfs.lstat(self._path).st_size
1709 def date(self): 1713 def date(self):
1710 t, tz = self._changectx.date() 1714 t, tz = self._changectx.date()
2145 def renamed(self): 2149 def renamed(self):
2146 path = self._parent.copydata(self._path) 2150 path = self._parent.copydata(self._path)
2147 if not path: 2151 if not path:
2148 return None 2152 return None
2149 return path, self._changectx._parents[0]._manifest.get(path, nullid) 2153 return path, self._changectx._parents[0]._manifest.get(path, nullid)
2154
2155 def copysource(self):
2156 return self._parent.copydata(self._path)
2150 2157
2151 def size(self): 2158 def size(self):
2152 return self._parent.size(self._path) 2159 return self._parent.size(self._path)
2153 2160
2154 def markcopied(self, origin): 2161 def markcopied(self, origin):