histedit: use overlayfilectx

Summary:
Resend of https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-May/097695.html

Like the previous patch, this simplifies the code, and could make things faster
for mode-only changes.

Reviewed By: DurhamG

Differential Revision: D8986781

fbshipit-source-id: 993a97ade9a41627735a65919de9ab52b600a180
This commit is contained in:
Jun Wu 2018-07-27 19:54:53 -07:00 committed by Facebook Github Bot
parent e9a9857678
commit 817968c8f8

View File

@ -635,17 +635,7 @@ def collapse(repo, first, last, commitopts, skipprompt=False):
def filectxfn(repo, ctx, path):
if path in headmf:
fctx = last[path]
flags = fctx.flags()
mctx = context.memfilectx(
repo,
ctx,
fctx.path(),
fctx.data(),
islink="l" in flags,
isexec="x" in flags,
copied=copied.get(path),
)
return mctx
return context.overlayfilectx(fctx, ctx=ctx, copied=copied.get(path, False))
return None
if commitopts.get("message"):