# HG changeset patch # User Sushil khanchi # Date 1561479862 -19800 # Node ID 5f90eb8fd63c937e1898baedbf747d8e1da57f43 # Parent e15dc6defc998a4c360b9d6e07ec59c3459d2685 evolve: fix confusion in branch heads checking logic when topic in play To provide some context, when topics are in play the branchmap cache we store contains the branch info of a rev as "branch:topic" format IIUC. Assuming that is right, now in present code we don't actually cover this part that "when looking for branch heads where we also have active topic we should look for branch='branch_name:topic' instead". And we get wrong branch heads as a result. This patch make sure that we pass right candidate to find branch heads using branchmap.branchheads() by overriding the localrepo.branchheads() Changes in test file reflect the fixed behavior. diff -r e15dc6defc99 -r 5f90eb8fd63c CHANGELOG --- a/CHANGELOG Sun Apr 14 12:55:46 2019 +0530 +++ b/CHANGELOG Tue Jun 25 21:54:22 2019 +0530 @@ -7,6 +7,8 @@ * evolve: use the same wording as core in case of unresolved conflict * evolve: minor output message improvements * evolve: improve `hg evolve --all` behavior when "." is obsolete + * topic: fix confusion in branch heads checking logic + 9.0.0 -- 2019-06-06 ------------------- diff -r e15dc6defc99 -r 5f90eb8fd63c hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sun Apr 14 12:55:46 2019 +0530 +++ b/hgext3rd/topic/__init__.py Tue Jun 25 21:54:22 2019 +0530 @@ -436,6 +436,15 @@ return super(topicrepo, self).branchmap() return self.filtered(topicfilter).branchmap() + def branchheads(self, branch=None, start=None, closed=False): + if branch is None: + branch = self[None].branch() + if self.currenttopic: + branch = "%s:%s" % (branch, self.currenttopic) + return super(topicrepo, self).branchheads(branch=branch, + start=start, + closed=closed) + def invalidatevolatilesets(self): # XXX we might be able to move this to something invalidated less often super(topicrepo, self).invalidatevolatilesets() diff -r e15dc6defc99 -r 5f90eb8fd63c tests/test-topic-stack-data.t --- a/tests/test-topic-stack-data.t Sun Apr 14 12:55:46 2019 +0530 +++ b/tests/test-topic-stack-data.t Tue Jun 25 21:54:22 2019 +0530 @@ -116,7 +116,7 @@ add foo_b branch: lake commit: (clean) - update: 2 new changesets (update) + update: (current) phases: 22 draft orphan: 3 changesets topic: foo diff -r e15dc6defc99 -r 5f90eb8fd63c tests/test-topic-stack.t --- a/tests/test-topic-stack.t Sun Apr 14 12:55:46 2019 +0530 +++ b/tests/test-topic-stack.t Tue Jun 25 21:54:22 2019 +0530 @@ -315,7 +315,7 @@ c_d branch: default commit: (clean) - update: (current) + update: 2 new changesets (update) phases: 4 draft topic: foo diff -r e15dc6defc99 -r 5f90eb8fd63c tests/test-topic.t --- a/tests/test-topic.t Sun Apr 14 12:55:46 2019 +0530 +++ b/tests/test-topic.t Tue Jun 25 21:54:22 2019 +0530 @@ -1084,11 +1084,9 @@ changed topic on 1 changesets to "foo" Try to put a tag on current rev which also has an active topic: -XXX: it shouldn't have aborted here $ hg tag 1.0 - abort: working directory is not at a branch head (use -f to force) - [255] $ hg tags - tip 2:3bbb3fdb2546 + tip 3:9efc5c3ac635 + 1.0 2:3bbb3fdb2546 $ cd ..