comparison hgext3rd/topic/stack.py @ 4828:aaf8742e09a0 stable

stack: demonstrate that not reusing cached property gives different results Instead of using self._dependencies, which is a cached property, let's get fresh deps and rdeps in stack.revs method using a newly introduced stack.builddependencies method (will be removed in the next patch). This makes it easier to explain why the next patch is correct.
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 06 Sep 2019 12:16:34 +0700
parents f30c1fab7155
children 6b82b4f72347
comparison
equal deleted inserted replaced
4826:efc76b1563f0 4828:aaf8742e09a0
86 def index(self, item): 86 def index(self, item):
87 return self.revs.index(item) 87 return self.revs.index(item)
88 88
89 @util.propertycache 89 @util.propertycache
90 def _dependencies(self): 90 def _dependencies(self):
91 return self.builddependencies()
92
93 def builddependencies(self):
91 deps, rdeps = builddependencies(self._repo, self._revs) 94 deps, rdeps = builddependencies(self._repo, self._revs)
92 95
93 repo = self._repo 96 repo = self._repo
94 srcpfunc = repo.changelog.parentrevs 97 srcpfunc = repo.changelog.parentrevs
95 98
141 def revs(self): 144 def revs(self):
142 # some duplication/change from _orderrevs because we use a post 145 # some duplication/change from _orderrevs because we use a post
143 # processed dependency graph. 146 # processed dependency graph.
144 147
145 # Step 1: compute relation of revision with each other 148 # Step 1: compute relation of revision with each other
146 dependencies, rdependencies = self._dependencies 149 dependencies, rdependencies = self.builddependencies()
147 dependencies = dependencies.copy() 150 dependencies = dependencies.copy()
148 rdependencies = rdependencies.copy() 151 rdependencies = rdependencies.copy()
149 # Step 2: Build the ordering 152 # Step 2: Build the ordering
150 # Remove the revisions with no dependency(A) and add them to the ordering. 153 # Remove the revisions with no dependency(A) and add them to the ordering.
151 # Removing these revisions leads to new revisions with no dependency (the 154 # Removing these revisions leads to new revisions with no dependency (the