# HG changeset patch # User Patrick Mezard # Date 1182105343 -7200 # Node ID 88fc92b0b8214aa677a40075d03df71bce7e21b2 # Parent b25ee3f8f7146ce8804e3e109e5dd64e3adfad21 patchbomb: page patchbomb messages only if PAGER is defined. Paging is complicated under win32. It is just better to avoid it by default. diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -44,7 +44,8 @@ # the "email" command with the "-n" option (test only). You will be # prompted for an email recipient address, a subject an an introductory # message describing the patches of your patchbomb. Then when all is -# done, your pager will be fired up once for each patchbomb message, so +# done, patchbomb messages are displayed. If PAGER environment variable +# is set, your pager will be fired up once for each patchbomb message, so # you can verify everything is alright. # # The "-m" (mbox) option is also very useful. Instead of previewing @@ -381,14 +382,18 @@ def patchbomb(ui, repo, *revs, **opts): if opts['test']: ui.status('Displaying ', m['Subject'], ' ...\n') ui.flush() - fp = os.popen(os.getenv('PAGER', 'more'), 'w') + if 'PAGER' in os.environ: + fp = os.popen(os['PAGER'], 'w') + else: + fp = ui try: fp.write(m.as_string(0)) fp.write('\n') except IOError, inst: if inst.errno != errno.EPIPE: raise - fp.close() + if fp is not ui: + fp.close() elif opts['mbox']: ui.status('Writing ', m['Subject'], ' ...\n') fp = open(opts['mbox'], m.has_key('In-Reply-To') and 'ab+' or 'wb+')