comparison mercurial/dirstate.py @ 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 811a79bfb8bb
children c5190adc17d5
comparison
equal deleted inserted replaced
47588:eb611ecb435c 47589:f5c24c124e07
385 # Also fix up otherparent markers 385 # Also fix up otherparent markers
386 elif s.from_p2: 386 elif s.from_p2:
387 source = self._map.copymap.get(f) 387 source = self._map.copymap.get(f)
388 if source: 388 if source:
389 copies[f] = source 389 copies[f] = source
390 self.add(f) 390 self._add(f)
391 return copies 391 return copies
392 392
393 def setbranch(self, branch): 393 def setbranch(self, branch):
394 self.__class__._branch.set(self, encoding.fromlocal(branch)) 394 self.__class__._branch.set(self, encoding.fromlocal(branch))
395 f = self._opener(b'branch', b'w', atomictemp=True, checkambig=True) 395 f = self._opener(b'branch', b'w', atomictemp=True, checkambig=True)
545 self._addpath(f, from_p2=True) 545 self._addpath(f, from_p2=True)
546 self._map.copymap.pop(f, None) 546 self._map.copymap.pop(f, None)
547 547
548 def add(self, f): 548 def add(self, f):
549 '''Mark a file added.''' 549 '''Mark a file added.'''
550 self._addpath(f, added=True) 550 self._add(f)
551 self._map.copymap.pop(f, None) 551
552 def _add(self, filename):
553 """internal function to mark a file as added"""
554 self._addpath(filename, added=True)
555 self._map.copymap.pop(filename, None)
552 556
553 def remove(self, f): 557 def remove(self, f):
554 '''Mark a file removed.''' 558 '''Mark a file removed.'''
555 self._dirty = True 559 self._dirty = True
556 self._updatedfiles.add(f) 560 self._updatedfiles.add(f)