comparison mercurial/dirstate.py @ 47515:c94d3ff46fd5

dirstate-entry: add a `removed` property Lets start to define and use more semantic property. Differential Revision: https://phab.mercurial-scm.org/D10957
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 03 Jul 2021 04:18:54 +0200
parents 559aee84b889
children b8ffe85e399b
comparison
equal deleted inserted replaced
47514:559aee84b889 47515:c94d3ff46fd5
470 # shadows 470 # shadows
471 for d in pathutil.finddirs(f): 471 for d in pathutil.finddirs(f):
472 if self._map.hastrackeddir(d): 472 if self._map.hastrackeddir(d):
473 break 473 break
474 entry = self._map.get(d) 474 entry = self._map.get(d)
475 if entry is not None and entry.state != b'r': 475 if entry is not None and not entry.removed:
476 msg = _(b'file %r in dirstate clashes with %r') 476 msg = _(b'file %r in dirstate clashes with %r')
477 msg %= (pycompat.bytestr(d), pycompat.bytestr(f)) 477 msg %= (pycompat.bytestr(d), pycompat.bytestr(f))
478 raise error.Abort(msg) 478 raise error.Abort(msg)
479 if state == b'a': 479 if state == b'a':
480 assert not possibly_dirty 480 assert not possibly_dirty
529 # if there is a merge going on and the file was either 529 # if there is a merge going on and the file was either
530 # "merged" or coming from other parent (-2) before 530 # "merged" or coming from other parent (-2) before
531 # being removed, restore that state. 531 # being removed, restore that state.
532 entry = self._map.get(f) 532 entry = self._map.get(f)
533 if entry is not None: 533 if entry is not None:
534 if entry.state == b'r' and ( 534 if entry.removed and (entry[2] == NONNORMAL or entry.from_p2):
535 entry[2] == NONNORMAL or entry.from_p2
536 ):
537 source = self._map.copymap.get(f) 535 source = self._map.copymap.get(f)
538 if entry[2] == NONNORMAL: 536 if entry[2] == NONNORMAL:
539 self.merge(f) 537 self.merge(f)
540 elif entry.from_p2: 538 elif entry.from_p2:
541 self.otherparent(f) 539 self.otherparent(f)
1362 cadd(fn) 1360 cadd(fn)
1363 elif t.merged: 1361 elif t.merged:
1364 madd(fn) 1362 madd(fn)
1365 elif state == b'a': 1363 elif state == b'a':
1366 aadd(fn) 1364 aadd(fn)
1367 elif state == b'r': 1365 elif t.removed:
1368 radd(fn) 1366 radd(fn)
1369 status = scmutil.status( 1367 status = scmutil.status(
1370 modified, added, removed, deleted, unknown, ignored, clean 1368 modified, added, removed, deleted, unknown, ignored, clean
1371 ) 1369 )
1372 return (lookup, status) 1370 return (lookup, status)