Patchwork [06,of,13] mergestate: remove unnecessary recordactions() from mergestate class

login
register
mail settings
Submitter Pulkit Goyal
Date July 17, 2020, 8:59 a.m.
Message ID <8dd9eeb56cd015f1e323.1594976367@workspace>
Download mbox | patch
Permalink /patch/46779/
State Accepted
Headers show

Comments

Pulkit Goyal - July 17, 2020, 8:59 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1594299054 -19800
#      Thu Jul 09 18:20:54 2020 +0530
# Node ID 8dd9eeb56cd015f1e323fedad6c8d58de2d81bb1
# Parent  c571d56248d51c7ed396871495e9ddc989a8ce45
# EXP-Topic mergestate-refactor
mergestate: remove unnecessary recordactions() from mergestate class

This function is updating dirstate which sounds like not something which a
method on mergestate class should do. Also this just calls another function.
Lets directly call that function and remove this reducing mergestate
responsibility a bit.

There was single caller which is updated.

Differential Revision: https://phab.mercurial-scm.org/D8737

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6129,7 +6129,8 @@  def resolve(ui, repo, *pats, **opts):
                     raise
 
         ms.commit()
-        ms.recordactions()
+        branchmerge = repo.dirstate.p2() != nullid
+        mergestatemod.recordupdates(repo, ms.actions(), branchmerge, None)
 
         if not didwork and pats:
             hint = None
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -756,11 +756,6 @@  class mergestate(object):
                 actions[action].append((f, None, b"merge result"))
         return actions
 
-    def recordactions(self):
-        """record remove/add/get actions in the dirstate"""
-        branchmerge = self._repo.dirstate.p2() != nullid
-        recordupdates(self._repo, self.actions(), branchmerge, None)
-
     def queueremove(self, f):
         """queues a file to be removed from the dirstate