From patchwork Thu Jan 30 15:39:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D8040: mergestate: add accessors for local and other nodeid, not just contexts From: phabricator X-Patchwork-Id: 44780 Message-Id: <9911769c912efd8ca5c8b808809f7f81@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Thu, 30 Jan 2020 15:39:33 +0000 Closed by commit rHGb8b4d9ad4613: mergestate: add accessors for local and other nodeid, not just contexts (authored by martinvonz). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8040?vs=19700&id=19721 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8040/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8040 AFFECTED FILES mercurial/merge.py CHANGE DETAILS To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -386,18 +386,26 @@ return configmergedriver @util.propertycache - def localctx(self): + def local(self): if self._local is None: - msg = b"localctx accessed but self._local isn't set" + msg = b"local accessed but self._local isn't set" raise error.ProgrammingError(msg) - return self._repo[self._local] + return self._local + + @util.propertycache + def localctx(self): + return self._repo[self.local] + + @util.propertycache + def other(self): + if self._other is None: + msg = b"other accessed but self._other isn't set" + raise error.ProgrammingError(msg) + return self._other @util.propertycache def otherctx(self): - if self._other is None: - msg = b"otherctx accessed but self._other isn't set" - raise error.ProgrammingError(msg) - return self._repo[self._other] + return self._repo[self.other] def active(self): """Whether mergestate is active.