Show More
@@ -91,9 +91,9 b' def filterchunks(ui, originalhunks, usec' | |||||
91 | def recordfilter(ui, originalhunks, operation=None): |
|
91 | def recordfilter(ui, originalhunks, operation=None): | |
92 | """ Prompts the user to filter the originalhunks and return a list of |
|
92 | """ Prompts the user to filter the originalhunks and return a list of | |
93 | selected hunks. |
|
93 | selected hunks. | |
94 |
*operation* is used for |
|
94 | *operation* is used for to build ui messages to indicate the user what | |
95 |
|
|
95 | kind of filtering they are doing: reverting, committing, shelving, etc. | |
96 | *operation* has to be a translated string. |
|
96 | (see patch.filterpatch). | |
97 | """ |
|
97 | """ | |
98 | usecurses = crecordmod.checkcurses(ui) |
|
98 | usecurses = crecordmod.checkcurses(ui) | |
99 | testfile = ui.config('experimental', 'crecordtest', None) |
|
99 | testfile = ui.config('experimental', 'crecordtest', None) | |
@@ -3301,7 +3301,7 b' def _performrevert(repo, parents, ctx, a' | |||||
3301 | else: |
|
3301 | else: | |
3302 | diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) |
|
3302 | diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) | |
3303 | originalchunks = patch.parsepatch(diff) |
|
3303 | originalchunks = patch.parsepatch(diff) | |
3304 |
operation = |
|
3304 | operation = 'discard' if node == parent else 'revert' | |
3305 |
|
3305 | |||
3306 | try: |
|
3306 | try: | |
3307 |
|
3307 |
@@ -978,7 +978,19 b' class recordhunk(object):' | |||||
978 | def filterpatch(ui, headers, operation=None): |
|
978 | def filterpatch(ui, headers, operation=None): | |
979 | """Interactively filter patch chunks into applied-only chunks""" |
|
979 | """Interactively filter patch chunks into applied-only chunks""" | |
980 | if operation is None: |
|
980 | if operation is None: | |
981 |
operation = |
|
981 | operation = 'record' | |
|
982 | messages = { | |||
|
983 | 'multiple': { | |||
|
984 | 'discard': _("discard change %d/%d to '%s'?"), | |||
|
985 | 'record': _("record change %d/%d to '%s'?"), | |||
|
986 | 'revert': _("revert change %d/%d to '%s'?"), | |||
|
987 | }[operation], | |||
|
988 | 'single': { | |||
|
989 | 'discard': _("discard this change to '%s'?"), | |||
|
990 | 'record': _("record this change to '%s'?"), | |||
|
991 | 'revert': _("revert this change to '%s'?"), | |||
|
992 | }[operation], | |||
|
993 | } | |||
982 |
|
994 | |||
983 | def prompt(skipfile, skipall, query, chunk): |
|
995 | def prompt(skipfile, skipall, query, chunk): | |
984 | """prompt query, and process base inputs |
|
996 | """prompt query, and process base inputs | |
@@ -1109,12 +1121,10 b' the hunk is left unchanged.' | |||||
1109 | if skipfile is None and skipall is None: |
|
1121 | if skipfile is None and skipall is None: | |
1110 | chunk.pretty(ui) |
|
1122 | chunk.pretty(ui) | |
1111 | if total == 1: |
|
1123 | if total == 1: | |
1112 | msg = _("%s this change to '%s'?") % (operation, |
|
1124 | msg = messages['single'] % chunk.filename() | |
1113 | chunk.filename()) |
|
|||
1114 | else: |
|
1125 | else: | |
1115 | idx = pos - len(h.hunks) + i |
|
1126 | idx = pos - len(h.hunks) + i | |
1116 | msg = _("%s change %d/%d to '%s'?") % (operation, idx, total, |
|
1127 | msg = messages['multiple'] % (idx, total, chunk.filename()) | |
1117 | chunk.filename()) |
|
|||
1118 | r, skipfile, skipall, newpatches = prompt(skipfile, |
|
1128 | r, skipfile, skipall, newpatches = prompt(skipfile, | |
1119 | skipall, msg, chunk) |
|
1129 | skipall, msg, chunk) | |
1120 | if r: |
|
1130 | if r: |
General Comments 0
You need to be logged in to leave comments.
Login now