Show More
@@ -996,21 +996,17 b' class recordhunk(object):' | |||||
996 | def __repr__(self): |
|
996 | def __repr__(self): | |
997 | return '<hunk %r@%d>' % (self.filename(), self.fromline) |
|
997 | return '<hunk %r@%d>' % (self.filename(), self.fromline) | |
998 |
|
998 | |||
999 | def filterpatch(ui, headers, operation=None): |
|
|||
1000 | """Interactively filter patch chunks into applied-only chunks""" |
|
|||
1001 | if operation is None: |
|
|||
1002 | operation = 'record' |
|
|||
1003 |
|
|
999 | messages = { | |
1004 |
|
|
1000 | 'multiple': { | |
1005 |
|
|
1001 | 'discard': _("discard change %d/%d to '%s'?"), | |
1006 |
|
|
1002 | 'record': _("record change %d/%d to '%s'?"), | |
1007 |
|
|
1003 | 'revert': _("revert change %d/%d to '%s'?"), | |
1008 | }[operation], |
|
1004 | }, | |
1009 |
|
|
1005 | 'single': { | |
1010 |
|
|
1006 | 'discard': _("discard this change to '%s'?"), | |
1011 |
|
|
1007 | 'record': _("record this change to '%s'?"), | |
1012 |
|
|
1008 | 'revert': _("revert this change to '%s'?"), | |
1013 | }[operation], |
|
1009 | }, | |
1014 |
|
|
1010 | 'help': { | |
1015 |
|
|
1011 | 'discard': _('[Ynesfdaq?]' | |
1016 |
|
|
1012 | '$$ &Yes, discard this change' | |
@@ -1042,9 +1038,14 b' def filterpatch(ui, headers, operation=N' | |||||
1042 |
|
|
1038 | '$$ Revert &all changes to all remaining files' | |
1043 |
|
|
1039 | '$$ &Quit, reverting no changes' | |
1044 |
|
|
1040 | '$$ &? (display help)') | |
1045 | }[operation] |
|
1041 | } | |
1046 | } |
|
1042 | } | |
1047 |
|
1043 | |||
|
1044 | def filterpatch(ui, headers, operation=None): | |||
|
1045 | """Interactively filter patch chunks into applied-only chunks""" | |||
|
1046 | if operation is None: | |||
|
1047 | operation = 'record' | |||
|
1048 | ||||
1048 | def prompt(skipfile, skipall, query, chunk): |
|
1049 | def prompt(skipfile, skipall, query, chunk): | |
1049 | """prompt query, and process base inputs |
|
1050 | """prompt query, and process base inputs | |
1050 |
|
1051 | |||
@@ -1061,7 +1062,7 b' def filterpatch(ui, headers, operation=N' | |||||
1061 | if skipfile is not None: |
|
1062 | if skipfile is not None: | |
1062 | return skipfile, skipfile, skipall, newpatches |
|
1063 | return skipfile, skipfile, skipall, newpatches | |
1063 | while True: |
|
1064 | while True: | |
1064 | resps = messages['help'] |
|
1065 | resps = messages['help'][operation] | |
1065 | r = ui.promptchoice("%s %s" % (query, resps)) |
|
1066 | r = ui.promptchoice("%s %s" % (query, resps)) | |
1066 | ui.write("\n") |
|
1067 | ui.write("\n") | |
1067 | if r == 8: # ? |
|
1068 | if r == 8: # ? | |
@@ -1166,10 +1167,11 b' the hunk is left unchanged.' | |||||
1166 | if skipfile is None and skipall is None: |
|
1167 | if skipfile is None and skipall is None: | |
1167 | chunk.pretty(ui) |
|
1168 | chunk.pretty(ui) | |
1168 | if total == 1: |
|
1169 | if total == 1: | |
1169 | msg = messages['single'] % chunk.filename() |
|
1170 | msg = messages['single'][operation] % chunk.filename() | |
1170 | else: |
|
1171 | else: | |
1171 | idx = pos - len(h.hunks) + i |
|
1172 | idx = pos - len(h.hunks) + i | |
1172 |
msg = messages['multiple'] % (idx, total, |
|
1173 | msg = messages['multiple'][operation] % (idx, total, | |
|
1174 | chunk.filename()) | |||
1173 | r, skipfile, skipall, newpatches = prompt(skipfile, |
|
1175 | r, skipfile, skipall, newpatches = prompt(skipfile, | |
1174 | skipall, msg, chunk) |
|
1176 | skipall, msg, chunk) | |
1175 | if r: |
|
1177 | if r: |
General Comments 0
You need to be logged in to leave comments.
Login now