changeset 2664:ed6fb5f20b24

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)
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 25 Jun 2017 06:53:22 +0530
parents c01dc624b358
children 0ade6e87346b
files hgext3rd/topic/__init__.py tests/test-topic.t
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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