# HG changeset patch # User Anton Shestakov # Date 1567746994 -25200 # Node ID aaf8742e09a0c7903c7f97859407362de4ea23a9 # Parent efc76b1563f05cc9c29eca198d108bbce553f701 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. diff -r efc76b1563f0 -r aaf8742e09a0 hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Tue Sep 03 13:02:20 2019 +0700 +++ b/hgext3rd/topic/stack.py Fri Sep 06 12:16:34 2019 +0700 @@ -88,6 +88,9 @@ @util.propertycache def _dependencies(self): + return self.builddependencies() + + def builddependencies(self): deps, rdeps = builddependencies(self._repo, self._revs) repo = self._repo @@ -143,7 +146,7 @@ # processed dependency graph. # Step 1: compute relation of revision with each other - dependencies, rdependencies = self._dependencies + dependencies, rdependencies = self.builddependencies() dependencies = dependencies.copy() rdependencies = rdependencies.copy() # Step 2: Build the ordering diff -r efc76b1563f0 -r aaf8742e09a0 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Tue Sep 03 13:02:20 2019 +0700 +++ b/tests/test-topic-stack.t Fri Sep 06 12:16:34 2019 +0700 @@ -794,7 +794,7 @@ $ hg stack red ### topic: red - ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads + ### target: default (branch), 7 behind s5$ c_H (orphan) ^ c_G ^ c_D @@ -868,7 +868,7 @@ $ hg stack red ### topic: red - ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads + ### target: default (branch), 7 behind s5$ c_H (orphan) ^ c_G ^ c_D