changeset 47589:f5c24c124e07

dirstate: introduce an internal `_add` method We want to split current user of `dirstate.add` between `hg add`-like cases and update of the dirstate coming from update/merge. To do this we will introduce new API. The first step is to introduces an internal function that these new API migh use (or not use) to distinct between the migrated users and the others. Differential Revision: https://phab.mercurial-scm.org/D11010
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 07 Jul 2021 19:31:52 +0200
parents eb611ecb435c
children c5190adc17d5
files mercurial/dirstate.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Fri Jul 09 22:37:24 2021 +0200
+++ b/mercurial/dirstate.py	Wed Jul 07 19:31:52 2021 +0200
@@ -387,7 +387,7 @@
                     source = self._map.copymap.get(f)
                     if source:
                         copies[f] = source
-                    self.add(f)
+                    self._add(f)
         return copies
 
     def setbranch(self, branch):
@@ -547,8 +547,12 @@
 
     def add(self, f):
         '''Mark a file added.'''
-        self._addpath(f, added=True)
-        self._map.copymap.pop(f, None)
+        self._add(f)
+
+    def _add(self, filename):
+        """internal function to mark a file as added"""
+        self._addpath(filename, added=True)
+        self._map.copymap.pop(filename, None)
 
     def remove(self, f):
         '''Mark a file removed.'''