hgext/patchbomb.py
changeset 4480 6b84c8d2f66f
parent 4479 82bc6aef8b43
child 4483 a11e13d50645
equal deleted inserted replaced
4479:82bc6aef8b43 4480:6b84c8d2f66f
    68 import email.Utils, email.Encoders
    68 import email.Utils, email.Encoders
    69 from mercurial import cmdutil, commands, hg, mail, ui, patch, util
    69 from mercurial import cmdutil, commands, hg, mail, ui, patch, util
    70 from mercurial.i18n import _
    70 from mercurial.i18n import _
    71 from mercurial.node import *
    71 from mercurial.node import *
    72 
    72 
    73 try:
       
    74     # readline gives raw_input editing capabilities, but is not
       
    75     # present on windows
       
    76     import readline
       
    77 except ImportError: pass
       
    78 
       
    79 def patchbomb(ui, repo, *revs, **opts):
    73 def patchbomb(ui, repo, *revs, **opts):
    80     '''send changesets by email
    74     '''send changesets by email
    81 
    75 
    82     By default, diffs are sent in the format generated by hg export,
    76     By default, diffs are sent in the format generated by hg export,
    83     one per message.  The series starts with a "[PATCH 0 of N]"
    77     one per message.  The series starts with a "[PATCH 0 of N]"
   118     Before using this command, you will need to enable email in your hgrc.
   112     Before using this command, you will need to enable email in your hgrc.
   119     See the [email] section in hgrc(5) for details.
   113     See the [email] section in hgrc(5) for details.
   120     '''
   114     '''
   121 
   115 
   122     def prompt(prompt, default = None, rest = ': ', empty_ok = False):
   116     def prompt(prompt, default = None, rest = ': ', empty_ok = False):
       
   117         try:
       
   118             # readline gives raw_input editing capabilities, but is not
       
   119             # present on windows
       
   120             import readline
       
   121         except ImportError: pass
       
   122 
   123         if default: prompt += ' [%s]' % default
   123         if default: prompt += ' [%s]' % default
   124         prompt += rest
   124         prompt += rest
   125         while True:
   125         while True:
   126             r = raw_input(prompt)
   126             r = raw_input(prompt)
   127             if r: return r
   127             if r: return r