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)
--- 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)
--- 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