hgext/patchbomb.py
changeset 5479 f7c99e89178f
parent 5478 5223c360503e
child 5641 4d6b630d3939
child 5643 eae4553b2763
equal deleted inserted replaced
5478:5223c360503e 5479:f7c99e89178f
   128             if r: return r
   128             if r: return r
   129             if default is not None: return default
   129             if default is not None: return default
   130             if empty_ok: return r
   130             if empty_ok: return r
   131             ui.warn(_('Please enter a valid value.\n'))
   131             ui.warn(_('Please enter a valid value.\n'))
   132 
   132 
   133     def confirm(s):
   133     def confirm(s, denial):
   134         if not prompt(s, default = 'y', rest = '? ').lower().startswith('y'):
   134         if not prompt(s, default = 'y', rest = '? ').lower().startswith('y'):
   135             raise ValueError
   135             raise util.Abort(denial)
   136 
   136 
   137     def cdiffstat(summary, patchlines):
   137     def cdiffstat(summary, patchlines):
   138         s = patch.diffstat(patchlines)
   138         s = patch.diffstat(patchlines)
   139         if s:
   139         if s:
   140             if summary:
   140             if summary:
   141                 ui.write(summary, '\n')
   141                 ui.write(summary, '\n')
   142                 ui.write(s, '\n')
   142                 ui.write(s, '\n')
   143             confirm(_('Does the diffstat above look okay'))
   143             confirm(_('Does the diffstat above look okay'),
       
   144                     _('diffstat rejected'))
   144         elif s is None:
   145         elif s is None:
   145             ui.warn(_('No diffstat information available.\n'))
   146             ui.warn(_('No diffstat information available.\n'))
   146             s = ''
   147             s = ''
   147         return s
   148         return s
   148 
   149