comparison mercurial/cmdutil.py @ 48104:e8d6261513b9

dirstate-item: use item's property instead of `state` in revert Differential Revision: https://phab.mercurial-scm.org/D11541
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 29 Sep 2021 18:37:20 +0200
parents 304267b077de
children 5ced12cfa41b
comparison
equal deleted inserted replaced
48103:8f452fecd0a4 48104:e8d6261513b9
3350 3350
3351 # if f is a rename, update `names` to also revert the source 3351 # if f is a rename, update `names` to also revert the source
3352 for f in localchanges: 3352 for f in localchanges:
3353 src = repo.dirstate.copied(f) 3353 src = repo.dirstate.copied(f)
3354 # XXX should we check for rename down to target node? 3354 # XXX should we check for rename down to target node?
3355 if src and src not in names and repo.dirstate[src] == b'r': 3355 if (
3356 src
3357 and src not in names
3358 and repo.dirstate.get_entry(src).removed
3359 ):
3356 dsremoved.add(src) 3360 dsremoved.add(src)
3357 names[src] = True 3361 names[src] = True
3358 3362
3359 # determine the exact nature of the deleted changesets 3363 # determine the exact nature of the deleted changesets
3360 deladded = set(_deleted) 3364 deladded = set(_deleted)
3364 deleted = _deleted - deladded 3368 deleted = _deleted - deladded
3365 3369
3366 # distinguish between file to forget and the other 3370 # distinguish between file to forget and the other
3367 added = set() 3371 added = set()
3368 for abs in dsadded: 3372 for abs in dsadded:
3369 if repo.dirstate[abs] != b'a': 3373 if not repo.dirstate.get_entry(abs).added:
3370 added.add(abs) 3374 added.add(abs)
3371 dsadded -= added 3375 dsadded -= added
3372 3376
3373 for abs in deladded: 3377 for abs in deladded:
3374 if repo.dirstate[abs] == b'a': 3378 if repo.dirstate.get_entry(abs).added:
3375 dsadded.add(abs) 3379 dsadded.add(abs)
3376 deladded -= dsadded 3380 deladded -= dsadded
3377 3381
3378 # For files marked as removed, we check if an unknown file is present at 3382 # For files marked as removed, we check if an unknown file is present at
3379 # the same path. If a such file exists it may need to be backed up. 3383 # the same path. If a such file exists it may need to be backed up.