# HG changeset patch # User Yuya Nishihara # Date 2017-02-25 08:27:48 # Node ID 5b2e1689b24d3f647bcacee58faee7134261ec75 # Parent 766364caae14745ea06b3c77009b9a50ad940d42 patchbomb: use modern pager to display -n/--test result (BC) This should provide more consistent UX, but is a BC because the pager will no longer be fired up for each message. diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -83,7 +83,6 @@ from mercurial.i18n import _ from mercurial import ( cmdutil, commands, - encoding, error, formatter, hg, @@ -498,9 +497,7 @@ def email(ui, repo, *revs, **opts): 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 @@ def email(ui, repo, *revs, **opts): 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) diff --git a/tests/test-patchbomb-tls.t b/tests/test-patchbomb-tls.t --- a/tests/test-patchbomb-tls.t +++ b/tests/test-patchbomb-tls.t @@ -10,10 +10,6 @@ Set up SMTP server: listening at localhost:$HGPORT $ cat a.pid >> $DAEMON_PIDS -Ensure hg email output is sent to stdout: - - $ unset PAGER - Set up repository: $ hg init t diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t --- a/tests/test-patchbomb.t +++ b/tests/test-patchbomb.t @@ -28,9 +28,6 @@ Mercurial-patchbomb/.* -> Mercurial-patc $ echo "[extensions]" >> $HGRCPATH $ echo "patchbomb=" >> $HGRCPATH -Ensure hg email output is sent to stdout - $ unset PAGER - $ hg init t $ cd t $ echo a > a