# HG changeset patch # User Pierre-Yves David # Date 1595960466 -7200 # Node ID 54eeb1a0e325e5e731cad7b5334983db99c5a6b1 # Parent 027f3dd76302fda284aa7eb9b72dc6984c82c3f3 commitctx: directly update the touched and added set of files Instead of going through intermediate variable, we can simply use the ChangingFiles object. The object will take care of the consistency. diff -r 027f3dd76302 -r 54eeb1a0e325 mercurial/commit.py --- a/mercurial/commit.py Tue Jul 28 20:19:09 2020 +0200 +++ b/mercurial/commit.py Tue Jul 28 20:21:06 2020 +0200 @@ -158,11 +158,11 @@ m1 = m1ctx.read() m2 = m2ctx.read() + files = metadata.ChangingFiles() + # check in files added = [] - filesadded = [] removed = list(ctx.removed()) - touched = [] linkrev = len(repo) repo.ui.note(_(b"committing files:\n")) uipathfn = scmutil.getuipathfn(repo) @@ -178,9 +178,10 @@ repo, fctx, m1, m2, linkrev, tr, writefilecopymeta, ) if is_touched: - touched.append(f) if is_touched == 'added': - filesadded.append(f) + files.mark_added(f) + else: + files.mark_touched(f) m.setflag(f, fctx.flags()) except OSError: repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f)) @@ -191,7 +192,6 @@ repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f)) raise - files = metadata.ChangingFiles(touched=touched, added=filesadded) # update manifest removed = [f for f in removed if f in m1 or f in m2] drop = sorted([f for f in removed if f in m])