Show More
@@ -299,7 +299,7 b' class filefixupstate:' | |||
|
299 | 299 | 4. read results from "finalcontents", or call getfinalcontent |
|
300 | 300 | """ |
|
301 | 301 | |
|
302 |
def __init__(self, fctxs, path, ui=None, opts |
|
|
302 | def __init__(self, fctxs, path, ui=None, **opts): | |
|
303 | 303 | """([fctx], ui or None) -> None |
|
304 | 304 | |
|
305 | 305 | fctxs should be linear, and sorted by topo order - oldest first. |
@@ -308,7 +308,7 b' class filefixupstate:' | |||
|
308 | 308 | self.fctxs = fctxs |
|
309 | 309 | self.path = path |
|
310 | 310 | self.ui = ui or nullui() |
|
311 |
self.opts = opts |
|
|
311 | self.opts = opts | |
|
312 | 312 | |
|
313 | 313 | # following fields are built from fctxs. they exist for perf reason |
|
314 | 314 | self.contents = [f.data() for f in fctxs] |
@@ -375,7 +375,7 b' class filefixupstate:' | |||
|
375 | 375 | % (short(self.fctxs[idx].node()), a1, a2, len(blines)) |
|
376 | 376 | ) |
|
377 | 377 | self.linelog.replacelines(rev, a1, a2, b1, b2) |
|
378 |
if self.opts.get( |
|
|
378 | if self.opts.get('edit_lines', False): | |
|
379 | 379 | self.finalcontents = self._checkoutlinelogwithedits() |
|
380 | 380 | else: |
|
381 | 381 | self.finalcontents = self._checkoutlinelog() |
@@ -668,7 +668,7 b' class fixupstate:' | |||
|
668 | 668 | 4. call commit, to commit changes to hg database |
|
669 | 669 | """ |
|
670 | 670 | |
|
671 |
def __init__(self, stack, ui=None, opts |
|
|
671 | def __init__(self, stack, ui=None, **opts): | |
|
672 | 672 | """([ctx], ui or None) -> None |
|
673 | 673 | |
|
674 | 674 | stack: should be linear, and sorted by topo order - oldest first. |
@@ -676,7 +676,7 b' class fixupstate:' | |||
|
676 | 676 | """ |
|
677 | 677 | assert stack |
|
678 | 678 | self.ui = ui or nullui() |
|
679 |
self.opts = opts |
|
|
679 | self.opts = opts | |
|
680 | 680 | self.stack = stack |
|
681 | 681 | self.repo = stack[-1].repo().unfiltered() |
|
682 | 682 | |
@@ -696,7 +696,7 b' class fixupstate:' | |||
|
696 | 696 | self.paths = [] |
|
697 | 697 | # but if --edit-lines is used, the user may want to edit files |
|
698 | 698 | # even if they are not modified |
|
699 |
editopt = self.opts.get( |
|
|
699 | editopt = self.opts.get('edit_lines') | |
|
700 | 700 | if not self.status.modified and editopt and match: |
|
701 | 701 | interestingpaths = match.files() |
|
702 | 702 | else: |
@@ -720,7 +720,7 b' class fixupstate:' | |||
|
720 | 720 | continue |
|
721 | 721 | seenfctxs.update(fctxs[1:]) |
|
722 | 722 | self.fctxmap[path] = ctx2fctx |
|
723 |
fstate = filefixupstate(fctxs, path, ui=self.ui, |
|
|
723 | fstate = filefixupstate(fctxs, path, ui=self.ui, **self.opts) | |
|
724 | 724 | if fm is not None: |
|
725 | 725 | fm.startitem() |
|
726 | 726 | fm.plain(b'showing changes for ') |
@@ -1009,7 +1009,7 b' def overlaydiffcontext(ctx, chunks):' | |||
|
1009 | 1009 | return overlaycontext(memworkingcopy, ctx) |
|
1010 | 1010 | |
|
1011 | 1011 | |
|
1012 |
def absorb(ui, repo, stack=None, targetctx=None, pats=None, opts |
|
|
1012 | def absorb(ui, repo, stack=None, targetctx=None, pats=None, **opts): | |
|
1013 | 1013 | """pick fixup chunks from targetctx, apply them to stack. |
|
1014 | 1014 | |
|
1015 | 1015 | if targetctx is None, the working copy context will be used. |
@@ -1036,22 +1036,21 b' def absorb(ui, repo, stack=None, targetc' | |||
|
1036 | 1036 | targetctx = repo[None] |
|
1037 | 1037 | if pats is None: |
|
1038 | 1038 | pats = () |
|
1039 | if opts is None: | |
|
1040 | opts = {} | |
|
1041 | state = fixupstate(stack, ui=ui, opts=opts) | |
|
1042 | matcher = scmutil.match(targetctx, pats, opts) | |
|
1043 | if opts.get(b'interactive'): | |
|
1039 | ||
|
1040 | state = fixupstate(stack, ui=ui, **opts) | |
|
1041 | matcher = scmutil.match(targetctx, pats, pycompat.byteskwargs(opts)) | |
|
1042 | if opts.get('interactive'): | |
|
1044 | 1043 | diff = patch.diff(repo, stack[-1].node(), targetctx.node(), matcher) |
|
1045 | 1044 | origchunks = patch.parsepatch(diff) |
|
1046 | 1045 | chunks = cmdutil.recordfilter(ui, origchunks, matcher)[0] |
|
1047 | 1046 | targetctx = overlaydiffcontext(stack[-1], chunks) |
|
1048 |
if opts.get( |
|
|
1047 | if opts.get('edit_lines'): | |
|
1049 | 1048 | # If we're going to open the editor, don't ask the user to confirm |
|
1050 | 1049 | # first |
|
1051 |
opts[ |
|
|
1050 | opts['apply_changes'] = True | |
|
1052 | 1051 | fm = None |
|
1053 |
if opts.get( |
|
|
1054 | fm = ui.formatter(b'absorb', opts) | |
|
1052 | if opts.get('print_changes') or not opts.get('apply_changes'): | |
|
1053 | fm = ui.formatter(b'absorb', pycompat.byteskwargs(opts)) | |
|
1055 | 1054 | state.diffwith(targetctx, matcher, fm) |
|
1056 | 1055 | if fm is not None: |
|
1057 | 1056 | fm.startitem() |
@@ -1074,9 +1073,9 b' def absorb(ui, repo, stack=None, targetc' | |||
|
1074 | 1073 | label=b'absorb.description', |
|
1075 | 1074 | ) |
|
1076 | 1075 | fm.end() |
|
1077 |
if not opts.get( |
|
|
1076 | if not opts.get('dry_run'): | |
|
1078 | 1077 | if ( |
|
1079 |
not opts.get( |
|
|
1078 | not opts.get('apply_changes') | |
|
1080 | 1079 | and state.ctxaffected |
|
1081 | 1080 | and ui.promptchoice( |
|
1082 | 1081 | b"apply changes (y/N)? $$ &Yes $$ &No", default=1 |
@@ -1154,12 +1153,10 b' def absorbcmd(ui, repo, *pats, **opts):' | |||
|
1154 | 1153 | |
|
1155 | 1154 | Returns 0 on success, 1 if all chunks were ignored and nothing amended. |
|
1156 | 1155 | """ |
|
1157 | opts = pycompat.byteskwargs(opts) | |
|
1158 | ||
|
1159 | 1156 | with repo.wlock(), repo.lock(): |
|
1160 |
if not opts[ |
|
|
1157 | if not opts['dry_run']: | |
|
1161 | 1158 | cmdutil.checkunfinished(repo) |
|
1162 | 1159 | |
|
1163 |
state = absorb(ui, repo, pats=pats, |
|
|
1160 | state = absorb(ui, repo, pats=pats, **opts) | |
|
1164 | 1161 | if sum(s[0] for s in state.chunkstats.values()) == 0: |
|
1165 | 1162 | return 1 |
General Comments 0
You need to be logged in to leave comments.
Login now