89 return patch.filterpatch(ui, originalhunks, operation) |
89 return patch.filterpatch(ui, originalhunks, operation) |
90 |
90 |
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 ui purposes to indicate the user |
94 *operation* is used for to build ui messages to indicate the user what |
95 what kind of filtering they are doing: reverting, committing, shelving, etc. |
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) |
100 oldwrite = setupwrapcolorwrite(ui) |
100 oldwrite = setupwrapcolorwrite(ui) |
101 try: |
101 try: |
3299 if reversehunks: |
3299 if reversehunks: |
3300 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts) |
3300 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts) |
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 = _('discard') if node == parent else _('revert') |
3304 operation = 'discard' if node == parent else 'revert' |
3305 |
3305 |
3306 try: |
3306 try: |
3307 |
3307 |
3308 chunks, opts = recordfilter(repo.ui, originalchunks, |
3308 chunks, opts = recordfilter(repo.ui, originalchunks, |
3309 operation=operation) |
3309 operation=operation) |