Patchwork [04,of,11] commitctx: no longer use the `writecopiesto` variable in the function

login
register
mail settings
Submitter Pierre-Yves David
Date July 24, 2020, 2:38 p.m.
Message ID <93c606831026b6c9644a.1595601509@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/46871/
State Accepted
Headers show

Comments

Pierre-Yves David - July 24, 2020, 2:38 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1595531010 -7200
#      Thu Jul 23 21:03:30 2020 +0200
# Node ID 93c606831026b6c9644ad84a89204a2338a8aa03
# Parent  113fcffb030358b64b4cf7331bbde2e85758ab27
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#              hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 93c606831026
commitctx: no longer use the `writecopiesto` variable in the function

The `writefilecopymeta` variable already carry the same information, so we can
use `writefilecopymeta` in the one conditional where `writecopiesto` was used.

Patch

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -47,7 +47,6 @@  def commitctx(repo, ctx, error=False, or
     if repo.filecopiesmode == b'changeset-sidedata':
         writechangesetcopy = True
         writefilecopymeta = True
-        writecopiesto = None
     else:
         writecopiesto = repo.ui.config(b'experimental', b'copies.write-to')
         writefilecopymeta = writecopiesto != b'changeset-only'
@@ -134,7 +133,7 @@  def commitctx(repo, ctx, error=False, or
             files = touched
             mn = _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop)
 
-        if writecopiesto == b'changeset-only':
+        if not writefilecopymeta:
             # If writing only to changeset extras, use None to indicate that
             # no entry should be written. If writing to both, write an empty
             # entry to prevent the reader from falling back to reading