topic: further simplify the clear logic
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 21 Jun 2017 11:55:45 +0200
changeset 2645 2e3f63f4a519
parent 2644 78de089a7830
child 2646 b5723184fc62
topic: further simplify the clear logic We just set 'topic' to None and the rest should follow.
hgext3rd/topic/__init__.py
--- 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')