Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 31840:7973e0a15bd4
metadataonlyctx: replace "changeset()[0]" to "manifestnode()"
As Yuya pointed out [1], "changeset()[0]" could be simplified to
"manifestnode()". I didn't notice that method earlier. It should definitely
be used - it's easier to read, and faster.
[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095716.html
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 07 Apr 2017 11:02:43 -0700 |
parents | f33c9a5e81cd |
children | 826e600605f6 |
comparison
equal
deleted
inserted
replaced
31839:5b048d5f8884 | 31840:7973e0a15bd4 |
---|---|
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.changeset()[0] != mp1: | 2057 if p1 != nullid and p1.manifestnode() != 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.changeset()[0] != mp2: | 2060 if p2 != nullid and p2.manifestnode() != 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 = {} |