# HG changeset patch # User Pierre-Yves David # Date 2020-07-25 14:07:38 # Node ID 99614011892beda1beafdf9ddf5a98ab7837ebba # Parent c6eea580455185eb06416cc9475eb7b680441d7e commitctx: directly gather p1 and p2 copies in `files` The only thing we do with the p1copies and p2copies is to pass them around, we we can gather them later and directly stored them in the `ChangingFiles` object. diff --git a/mercurial/commit.py b/mercurial/commit.py --- a/mercurial/commit.py +++ b/mercurial/commit.py @@ -115,10 +115,6 @@ def _prepare_files(tr, ctx, error=False, writechangesetcopy, writefilecopymeta = _write_copy_meta(repo) - p1copies, p2copies = None, None - if writechangesetcopy: - p1copies = ctx.p1copies() - p2copies = ctx.p2copies() filesadded, filesremoved = None, None if ctx.manifestnode(): # reuse an existing manifest revision @@ -144,10 +140,9 @@ def _prepare_files(tr, ctx, error=False, files = metadata.ChangingFiles() if touched: files.update_touched(touched) - if p1copies: - files.update_copies_from_p1(p1copies) - if p2copies: - files.update_copies_from_p2(p2copies) + if writechangesetcopy: + files.update_copies_from_p1(ctx.p1copies()) + files.update_copies_from_p2(ctx.p2copies()) if filesadded: files.update_added(filesadded) if filesremoved: