comparison mercurial/context.py @ 31663:f33c9a5e81cd

metadataonlyctx: speed up sanity check Previously the sanity check will construct manifestctx for both p1 and p2. But it only needs the "manifest node" information, which could be read from changelog directly.
author Jun Wu <quark@fb.com>
date Sun, 26 Mar 2017 12:26:35 -0700
parents c93cdfa131a8
children 7973e0a15bd4
comparison
equal deleted inserted replaced
31662:080734cd2440 31663:f33c9a5e81cd
2052 p1, p2 = self._parents = [changectx(self._repo, p) for p in parents] 2052 p1, p2 = self._parents = [changectx(self._repo, p) for p in parents]
2053 2053
2054 # sanity check to ensure that the reused manifest parents are 2054 # sanity check to ensure that the reused manifest parents are
2055 # manifests of our commit parents 2055 # manifests of our commit parents
2056 mp1, mp2 = self.manifestctx().parents 2056 mp1, mp2 = self.manifestctx().parents
2057 if p1 != nullid and p1.manifestctx().node() != mp1: 2057 if p1 != nullid and p1.changeset()[0] != mp1:
2058 raise RuntimeError('can\'t reuse the manifest: ' 2058 raise RuntimeError('can\'t reuse the manifest: '
2059 'its p1 doesn\'t match the new ctx p1') 2059 'its p1 doesn\'t match the new ctx p1')
2060 if p2 != nullid and p2.manifestctx().node() != mp2: 2060 if p2 != nullid and p2.changeset()[0] != mp2:
2061 raise RuntimeError('can\'t reuse the manifest: ' 2061 raise RuntimeError('can\'t reuse the manifest: '
2062 'its p2 doesn\'t match the new ctx p2') 2062 'its p2 doesn\'t match the new ctx p2')
2063 2063
2064 self._files = originalctx.files() 2064 self._files = originalctx.files()
2065 self.substate = {} 2065 self.substate = {}