From patchwork Sun Feb 24 08:24:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D6008: context: add specialized way of getting copy source file only From: phabricator X-Patchwork-Id: 38896 Message-Id: <8c5253994921fbd434e77a1e1b431324@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Sun, 24 Feb 2019 08:24:29 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHG041d829575ed: context: add specialized way of getting copy source file only (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6008?vs=14196&id=14211 REVISION DETAIL https://phab.mercurial-scm.org/D6008 AFFECTED FILES hgext/remotefilelog/remotefilectx.py mercurial/context.py CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -691,6 +691,8 @@ return self._changectx def renamed(self): return self._copied + def copysource(self): + return self._copied and self._copied[0] def repo(self): return self._repo def size(self): @@ -1703,6 +1705,8 @@ if not rp: return None return rp, self._changectx._parents[0]._manifest.get(rp, nullid) + def copysource(self): + return self._repo.dirstate.copied(self._path) def size(self): return self._repo.wvfs.lstat(self._path).st_size @@ -2148,6 +2152,9 @@ return None return path, self._changectx._parents[0]._manifest.get(path, nullid) + def copysource(self): + return self._parent.copydata(self._path) + def size(self): return self._parent.size(self._path) diff --git a/hgext/remotefilelog/remotefilectx.py b/hgext/remotefilelog/remotefilectx.py --- a/hgext/remotefilelog/remotefilectx.py +++ b/hgext/remotefilelog/remotefilectx.py @@ -136,6 +136,10 @@ pass return renamed + def copysource(self): + copy = self.renamed() + return copy and copy[0] + def ancestormap(self): if not self._ancestormap: self._ancestormap = self.filelog().ancestormap(self._filenode)