Show More
@@ -70,11 +70,11 def recordfilter(ui, originalhunks, oper | |||
|
70 | 70 | testfile = ui.config('experimental', 'crecordtest', None) |
|
71 | 71 | oldwrite = setupwrapcolorwrite(ui) |
|
72 | 72 | try: |
|
73 |
newchunks = filterchunks(ui, originalhunks, usecurses, |
|
|
74 | operation) | |
|
73 | newchunks, newopts = filterchunks(ui, originalhunks, usecurses, | |
|
74 | testfile, operation) | |
|
75 | 75 | finally: |
|
76 | 76 | ui.write = oldwrite |
|
77 | return newchunks | |
|
77 | return newchunks, newopts | |
|
78 | 78 | |
|
79 | 79 | def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, |
|
80 | 80 | filterfn, *pats, **opts): |
@@ -121,9 +121,10 def dorecord(ui, repo, commitfunc, cmdsu | |||
|
121 | 121 | |
|
122 | 122 | # 1. filter patch, so we have intending-to apply subset of it |
|
123 | 123 | try: |
|
124 | chunks = filterfn(ui, originalchunks) | |
|
124 | chunks, newopts = filterfn(ui, originalchunks) | |
|
125 | 125 | except patch.PatchError as err: |
|
126 | 126 | raise error.Abort(_('error parsing patch: %s') % err) |
|
127 | opts.update(newopts) | |
|
127 | 128 | |
|
128 | 129 | # We need to keep a backup of files that have been newly added and |
|
129 | 130 | # modified during the recording process because there is a previous |
@@ -3201,7 +3202,7 def _performrevert(repo, parents, ctx, a | |||
|
3201 | 3202 | |
|
3202 | 3203 | try: |
|
3203 | 3204 | |
|
3204 | chunks = recordfilter(repo.ui, originalchunks) | |
|
3205 | chunks, opts = recordfilter(repo.ui, originalchunks) | |
|
3205 | 3206 | if reversehunks: |
|
3206 | 3207 | chunks = patch.reversehunks(chunks) |
|
3207 | 3208 |
@@ -454,7 +454,7 def filterpatch(ui, chunks, chunkselecto | |||
|
454 | 454 | uiheaders = [uiheader(h) for h in headers] |
|
455 | 455 | # let user choose headers/hunks/lines, and mark their applied flags |
|
456 | 456 | # accordingly |
|
457 | chunkselector(ui, uiheaders) | |
|
457 | ret = chunkselector(ui, uiheaders) | |
|
458 | 458 | appliedhunklist = [] |
|
459 | 459 | for hdr in uiheaders: |
|
460 | 460 | if (hdr.applied and |
@@ -472,7 +472,7 def filterpatch(ui, chunks, chunkselecto | |||
|
472 | 472 | else: |
|
473 | 473 | fixoffset += hnk.removed - hnk.added |
|
474 | 474 | |
|
475 | return appliedhunklist | |
|
475 | return (appliedhunklist, ret) | |
|
476 | 476 | |
|
477 | 477 | def gethw(): |
|
478 | 478 | """ |
@@ -501,6 +501,7 def chunkselector(ui, headerlist): | |||
|
501 | 501 | raise error.Abort(chunkselector.initerr) |
|
502 | 502 | # ncurses does not restore signal handler for SIGTSTP |
|
503 | 503 | signal.signal(signal.SIGTSTP, f) |
|
504 | return chunkselector.opts | |
|
504 | 505 | |
|
505 | 506 | def testdecorator(testfn, f): |
|
506 | 507 | def u(*args, **kwargs): |
@@ -521,6 +522,7 def testchunkselector(testfn, ui, header | |||
|
521 | 522 | while True: |
|
522 | 523 | if chunkselector.handlekeypressed(testcommands.pop(0), test=True): |
|
523 | 524 | break |
|
525 | return chunkselector.opts | |
|
524 | 526 | |
|
525 | 527 | class curseschunkselector(object): |
|
526 | 528 | def __init__(self, headerlist, ui): |
@@ -528,6 +530,7 class curseschunkselector(object): | |||
|
528 | 530 | self.headerlist = patch(headerlist) |
|
529 | 531 | |
|
530 | 532 | self.ui = ui |
|
533 | self.opts = {} | |
|
531 | 534 | |
|
532 | 535 | self.errorstr = None |
|
533 | 536 | # list of all chunks |
@@ -1106,8 +1106,8 the hunk is left unchanged. | |||
|
1106 | 1106 | applied[newhunk.filename()].append(newhunk) |
|
1107 | 1107 | else: |
|
1108 | 1108 | fixoffset += chunk.removed - chunk.added |
|
1109 | return sum([h for h in applied.itervalues() | |
|
1110 | if h[0].special() or len(h) > 1], []) | |
|
1109 | return (sum([h for h in applied.itervalues() | |
|
1110 | if h[0].special() or len(h) > 1], []), {}) | |
|
1111 | 1111 | class hunk(object): |
|
1112 | 1112 | def __init__(self, desc, num, lr, context): |
|
1113 | 1113 | self.number = num |
General Comments 0
You need to be logged in to leave comments.
Login now