# HG changeset patch
# User Sushil khanchi <sushilkhanchi97@gmail.com>
# Date 1541499798 -19800
#      Tue Nov 06 15:53:18 2018 +0530
# Branch stable
# Node ID 3eb78bdcdd7cd8be466d44ff489347a5432c44d3
# Parent  e796835fe6b3ea8bbc3094aa8337095accffae86
topic: improve UX by using pager only when we should

Before this patch we were using pager in every case of topic command,
either it is setting up a new topic or clearing the active topic.

After this patch it will not use pager in following commands:
$ hg topic [TOPIC] -r [rev]
$ hg topic --clear

diff --git a/CHANGELOG b/CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@
   * evolve: not longer attempt to translate revision's descriptions (issue6016)
   * evolve: fix compatibility with mercurial 4.8's narrow extension.
   * pick: fix summary help text
+  * topic: only use pager when it make senses
 
 8.3.1 -- 2018-10-25
 -------------------
diff --git a/hgext3rd/topic/__init__.py b/hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py
+++ b/hgext3rd/topic/__init__.py
@@ -652,9 +652,8 @@
                         " '_' and '.' characters")
             raise error.Abort(_("invalid topic name: '%s'") % topic, hint=helptxt)
 
-    ui.pager('topics')
-
     if list:
+        ui.pager('topics')
         if clear or rev:
             raise error.Abort(_("cannot use --clear or --rev with --list"))
         if not topic:
@@ -700,6 +699,7 @@
             ui.status(_('marked working directory as topic: %s\n') % topic)
         return _changecurrenttopic(repo, topic)
 
+    ui.pager('topics')
     # `hg topic --current`
     ret = 0
     if current and not ct: