changeset 2645:2e3f63f4a519

topic: further simplify the clear logic We just set 'topic' to None and the rest should follow.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 21 Jun 2017 11:55:45 +0200
parents 78de089a7830
children b5723184fc62
files hgext3rd/topic/__init__.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Wed Jun 21 03:28:25 2017 +0530
+++ b/hgext3rd/topic/__init__.py	Wed Jun 21 11:55:45 2017 +0200
@@ -274,14 +274,13 @@
     if rev:
         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
             raise error.Abort(_('must have obsolete enabled to change topics'))
-        if not topic and not clear:
+        if clear:
+            topic = None
+        elif not topic:
             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")
-        if clear:
-            _changetopics(ui, repo, rev, None)
-        else:
-            _changetopics(ui, repo, rev, topic)
+        _changetopics(ui, repo, rev, topic)
     if clear:
         if repo.vfs.exists('topic'):
             repo.vfs.unlink('topic')