mercurial/patch.py
changeset 34566 60213a2eca81
parent 34561 fe6125ebdf91
child 34855 35c6a54ec1ff
equal deleted inserted replaced
34565:4aa57627692a 34566:60213a2eca81
   992         return self.header.filename()
   992         return self.header.filename()
   993 
   993 
   994     def __repr__(self):
   994     def __repr__(self):
   995         return '<hunk %r@%d>' % (self.filename(), self.fromline)
   995         return '<hunk %r@%d>' % (self.filename(), self.fromline)
   996 
   996 
   997 messages = {
   997 def getmessages():
   998     'multiple': {
   998     return {
   999         'discard': _("discard change %d/%d to '%s'?"),
   999         'multiple': {
  1000         'record': _("record change %d/%d to '%s'?"),
  1000             'discard': _("discard change %d/%d to '%s'?"),
  1001         'revert': _("revert change %d/%d to '%s'?"),
  1001             'record': _("record change %d/%d to '%s'?"),
  1002     },
  1002             'revert': _("revert change %d/%d to '%s'?"),
  1003     'single': {
  1003         },
  1004         'discard': _("discard this change to '%s'?"),
  1004         'single': {
  1005         'record': _("record this change to '%s'?"),
  1005             'discard': _("discard this change to '%s'?"),
  1006         'revert': _("revert this change to '%s'?"),
  1006             'record': _("record this change to '%s'?"),
  1007     },
  1007             'revert': _("revert this change to '%s'?"),
  1008     'help': {
  1008         },
  1009         'discard': _('[Ynesfdaq?]'
  1009         'help': {
  1010                      '$$ &Yes, discard this change'
  1010             'discard': _('[Ynesfdaq?]'
  1011                      '$$ &No, skip this change'
  1011                          '$$ &Yes, discard this change'
  1012                      '$$ &Edit this change manually'
  1012                          '$$ &No, skip this change'
  1013                      '$$ &Skip remaining changes to this file'
  1013                          '$$ &Edit this change manually'
  1014                      '$$ Discard remaining changes to this &file'
  1014                          '$$ &Skip remaining changes to this file'
  1015                      '$$ &Done, skip remaining changes and files'
  1015                          '$$ Discard remaining changes to this &file'
  1016                      '$$ Discard &all changes to all remaining files'
  1016                          '$$ &Done, skip remaining changes and files'
  1017                      '$$ &Quit, discarding no changes'
  1017                          '$$ Discard &all changes to all remaining files'
  1018                      '$$ &? (display help)'),
  1018                          '$$ &Quit, discarding no changes'
  1019         'record': _('[Ynesfdaq?]'
  1019                          '$$ &? (display help)'),
  1020                     '$$ &Yes, record this change'
  1020             'record': _('[Ynesfdaq?]'
  1021                     '$$ &No, skip this change'
  1021                         '$$ &Yes, record this change'
  1022                     '$$ &Edit this change manually'
  1022                         '$$ &No, skip this change'
  1023                     '$$ &Skip remaining changes to this file'
  1023                         '$$ &Edit this change manually'
  1024                     '$$ Record remaining changes to this &file'
  1024                         '$$ &Skip remaining changes to this file'
  1025                     '$$ &Done, skip remaining changes and files'
  1025                         '$$ Record remaining changes to this &file'
  1026                     '$$ Record &all changes to all remaining files'
  1026                         '$$ &Done, skip remaining changes and files'
  1027                     '$$ &Quit, recording no changes'
  1027                         '$$ Record &all changes to all remaining files'
  1028                     '$$ &? (display help)'),
  1028                         '$$ &Quit, recording no changes'
  1029         'revert': _('[Ynesfdaq?]'
  1029                         '$$ &? (display help)'),
  1030                     '$$ &Yes, revert this change'
  1030             'revert': _('[Ynesfdaq?]'
  1031                     '$$ &No, skip this change'
  1031                         '$$ &Yes, revert this change'
  1032                     '$$ &Edit this change manually'
  1032                         '$$ &No, skip this change'
  1033                     '$$ &Skip remaining changes to this file'
  1033                         '$$ &Edit this change manually'
  1034                     '$$ Revert remaining changes to this &file'
  1034                         '$$ &Skip remaining changes to this file'
  1035                     '$$ &Done, skip remaining changes and files'
  1035                         '$$ Revert remaining changes to this &file'
  1036                     '$$ Revert &all changes to all remaining files'
  1036                         '$$ &Done, skip remaining changes and files'
  1037                     '$$ &Quit, reverting no changes'
  1037                         '$$ Revert &all changes to all remaining files'
  1038                     '$$ &? (display help)')
  1038                         '$$ &Quit, reverting no changes'
       
  1039                         '$$ &? (display help)')
       
  1040         }
  1039     }
  1041     }
  1040 }
       
  1041 
  1042 
  1042 def filterpatch(ui, headers, operation=None):
  1043 def filterpatch(ui, headers, operation=None):
  1043     """Interactively filter patch chunks into applied-only chunks"""
  1044     """Interactively filter patch chunks into applied-only chunks"""
       
  1045     messages = getmessages()
       
  1046 
  1044     if operation is None:
  1047     if operation is None:
  1045         operation = 'record'
  1048         operation = 'record'
  1046 
  1049 
  1047     def prompt(skipfile, skipall, query, chunk):
  1050     def prompt(skipfile, skipall, query, chunk):
  1048         """prompt query, and process base inputs
  1051         """prompt query, and process base inputs