Mercurial > hg-stable
changeset 31496:5b2e1689b24d
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 25 Feb 2017 17:27:48 +0900 |
parents | 766364caae14 |
children | 8122cc5cb543 |
files | hgext/patchbomb.py tests/test-patchbomb-tls.t tests/test-patchbomb.t |
diffstat | 3 files changed, 4 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- 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)