From patchwork Tue Oct 1 17:07:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D6933: context: clarify the various mode in the _copies property cache From: phabricator X-Patchwork-Id: 41905 Message-Id: <66f43f71ebc46e2bd56f7a88d15bc4a4@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 1 Oct 2019 17:07:50 +0000 Closed by commit rHG8af909893188: context: clarify the various mode in the _copies property cache (authored by marmoute). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6933?vs=16747&id=16753 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6933/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6933 AFFECTED FILES mercurial/context.py CHANGE DETAILS To: marmoute, martinvonz, durin42, #hg-reviewers, pulkit Cc: mercurial-devel diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -490,14 +490,22 @@ # In compatibility mode, we return copy data from the changeset if # it was recorded there, and otherwise we fall back to getting it from # the filelogs (below). - if (source == 'changeset-only' or - (source == 'compatibility' and p1copies is not None)): - return p1copies or {}, p2copies or {} - - # Otherwise (config said to read only from filelog, or we are in - # compatiblity mode and there is not data in the changeset), we get - # the copy metadata from the filelogs. - return super(changectx, self)._copies + if source == 'changeset-only': + if p1copies is None: + p1copies = {} + if p2copies is None: + p2copies = {} + elif source == 'compatibility': + if p1copies is None: + # we are in compatiblity mode and there is not data in the + # changeset), we get the copy metadata from the filelogs. + p1copies, p2copies = super(changectx, self)._copies + else: + # config said to read only from filelog, we get the copy metadata + # from the filelogs. + p1copies, p2copies = super(changectx, self)._copies + return p1copies, p2copies + def description(self): return self._changeset.description def branch(self):