hgext/patchbomb.py
changeset 31489 5b2e1689b24d
parent 31187 6b8e1a08ef1d
child 31490 8122cc5cb543
--- a/hgext/patchbomb.py	Sat Mar 18 16:02:14 2017 +0900
+++ b/hgext/patchbomb.py	Sat Feb 25 17:27:48 2017 +0900
@@ -83,7 +83,6 @@
 from mercurial import (
     cmdutil,
     commands,
-    encoding,
     error,
     formatter,
     hg,
@@ -498,9 +497,7 @@
     With -n/--test, all steps will run, but mail will not be sent.
     You will be prompted for an email recipient address, a subject and
     an introductory message describing the patches of your patchbomb.
-    Then when all is done, patchbomb messages are displayed. If the
-    PAGER environment variable is set, your pager will be fired up once
-    for each patchbomb message, so you can verify everything is alright.
+    Then when all is done, patchbomb messages are displayed.
 
     In case email sending fails, you will find a backup of your series
     introductory message in ``.hg/last-email.txt``.
@@ -719,19 +716,14 @@
         if opts.get('test'):
             ui.status(_('displaying '), subj, ' ...\n')
             ui.flush()
-            if 'PAGER' in encoding.environ and not ui.plain():
-                fp = util.popen(encoding.environ['PAGER'], 'w')
-            else:
-                fp = ui
-            generator = emailmod.Generator.Generator(fp, mangle_from_=False)
+            ui.pager('email')
+            generator = emailmod.Generator.Generator(ui, mangle_from_=False)
             try:
                 generator.flatten(m, 0)
-                fp.write('\n')
+                ui.write('\n')
             except IOError as inst:
                 if inst.errno != errno.EPIPE:
                     raise
-            if fp is not ui:
-                fp.close()
         else:
             if not sendmail:
                 sendmail = mail.connect(ui, mbox=mbox)