# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1498353802 -19800 # Node ID ed6fb5f20b249be880faa87df57f02cda6712fd8 # Parent c01dc624b358c02c24956f319dfc184048bec25c topics: return early so that other if conditions don't get execute (issue5600) We were not returning after the _changetopics() call and hence the if's below it were also executed which resulted in changing of current topic. This prevent current topic to be updated even when we only affect changeset unrelated to the working copy. Not that the rebase output change as it expose a new bug (rebased changeset gain a topic) diff -r c01dc624b358 -r ed6fb5f20b24 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Mon Jun 26 17:47:04 2017 +0200 +++ b/hgext3rd/topic/__init__.py Sun Jun 25 06:53:22 2017 +0530 @@ -286,7 +286,8 @@ raise error.Abort('changing topic requires a topic name or --clear') if any(not c.mutable() for c in repo.set('%r and public()', rev)): raise error.Abort("can't change topic of a public change") - _changetopics(ui, repo, rev, topic) + return _changetopics(ui, repo, rev, topic) + if clear: return _changecurrenttopic(repo, None) diff -r c01dc624b358 -r ed6fb5f20b24 tests/test-topic.t --- a/tests/test-topic.t Mon Jun 26 17:47:04 2017 +0200 +++ b/tests/test-topic.t Sun Jun 25 06:53:22 2017 +0530 @@ -603,9 +603,8 @@ update: 5 new changesets, 2 branch heads (merge) phases: 3 draft unstable: 1 changesets - topic: wat $ hg topic - * wat + wat $ hg log -Gr 'draft() and not obsolete()' o changeset: 13:686a642006db | tag: tip @@ -626,9 +625,10 @@ bonus deps in the testsuite. $ hg topic - * wat + wat $ hg rebase -d tip -s . rebasing 12:18b70b8de1f0 "fran?" + switching to topic wat $ hg topic * wat