comparison mercurial/cmdutil.py @ 22209:06fbd9518bc5

revert: detect files added during a merge In case of merge, file that are actually added can be reported as modified. This is currently handled by special-case code. We detect it beforehand instead. This will lets use remove the special-case code at some point in the future.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 24 Jun 2014 17:28:20 +0100
parents d3659b3795e9
children 537f55a27101
comparison
equal deleted inserted replaced
22208:d3659b3795e9 22209:06fbd9518bc5
2433 # the backup system is currently unabled to handle (2). 2433 # the backup system is currently unabled to handle (2).
2434 # 2434 #
2435 # So we just put them all in the same group. 2435 # So we just put them all in the same group.
2436 dsadded = added 2436 dsadded = added
2437 2437
2438 # in case of merge, files that are actually added can be reported as
2439 # modified, we need to post process the result
2440 if p2 != nullid:
2441 if pmf is None:
2442 # only need parent manifest in the merge case,
2443 # so do not read by default
2444 pmf = repo[parent].manifest()
2445 mergeadd = dsmodified - set(pmf)
2446 dsadded |= mergeadd
2447 dsmodified -= mergeadd
2448
2438 # if f is a rename, update `names` to also revert the source 2449 # if f is a rename, update `names` to also revert the source
2439 cwd = repo.getcwd() 2450 cwd = repo.getcwd()
2440 for f in dsadded: 2451 for f in dsadded:
2441 src = repo.dirstate.copied(f) 2452 src = repo.dirstate.copied(f)
2442 if src and src not in names and repo.dirstate[src] == 'r': 2453 if src and src not in names and repo.dirstate[src] == 'r':