Mercurial > hg
comparison mercurial/dirstate.py @ 48059:5d68c4eedd66
dirstate: move parent state handling in the dirstatemap
This involves dirstatemap data mostly. Moving this one level down will remove
the needs for the dirstatemap to expose some of its internals.
This will help us to simplify more code further.
Differential Revision: https://phab.mercurial-scm.org/D11505
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 22 Sep 2021 15:17:12 +0200 |
parents | 40dd56086056 |
children | 6a78715e56c8 |
comparison
equal
deleted
inserted
replaced
48058:40dd56086056 | 48059:5d68c4eedd66 |
---|---|
379 | 379 |
380 self._dirty = True | 380 self._dirty = True |
381 oldp2 = self._pl[1] | 381 oldp2 = self._pl[1] |
382 if self._origpl is None: | 382 if self._origpl is None: |
383 self._origpl = self._pl | 383 self._origpl = self._pl |
384 self._map.setparents(p1, p2) | |
385 copies = {} | |
386 nullid = self._nodeconstants.nullid | 384 nullid = self._nodeconstants.nullid |
387 if oldp2 != nullid and p2 == nullid: | 385 # True if we need to fold p2 related state back to a linear case |
388 candidatefiles = self._map.non_normal_or_other_parent_paths() | 386 fold_p2 = oldp2 != nullid and p2 == nullid |
389 | 387 return self._map.setparents(p1, p2, fold_p2=fold_p2) |
390 for f in candidatefiles: | |
391 s = self._map.get(f) | |
392 if s is None: | |
393 continue | |
394 | |
395 # Discard "merged" markers when moving away from a merge state | |
396 if s.merged: | |
397 source = self._map.copymap.get(f) | |
398 if source: | |
399 copies[f] = source | |
400 self._map.reset_state( | |
401 f, | |
402 wc_tracked=True, | |
403 p1_tracked=True, | |
404 possibly_dirty=True, | |
405 ) | |
406 # Also fix up otherparent markers | |
407 elif s.from_p2: | |
408 source = self._map.copymap.get(f) | |
409 if source: | |
410 copies[f] = source | |
411 self._map.reset_state( | |
412 f, | |
413 p1_tracked=False, | |
414 wc_tracked=True, | |
415 ) | |
416 return copies | |
417 | 388 |
418 def setbranch(self, branch): | 389 def setbranch(self, branch): |
419 self.__class__._branch.set(self, encoding.fromlocal(branch)) | 390 self.__class__._branch.set(self, encoding.fromlocal(branch)) |
420 f = self._opener(b'branch', b'w', atomictemp=True, checkambig=True) | 391 f = self._opener(b'branch', b'w', atomictemp=True, checkambig=True) |
421 try: | 392 try: |