comparison mercurial/mergestate.py @ 48763:93d6f0e7ba2f

filemerge: move check for identical sides out of filemerge() `filemerge.filemerge()` returns `None` if no merge was necessary because the two sides were identical. I don't think it should be that function's responsibility to handle that case; we should ideally not even call `filemerge.filemerge()` if the two inputs identical. This patch therefore moves the check out to the caller (`mergestate.py`). The largefiles test changed because we now notice that the two sides made the same change, so we don't consider it a merge. Also note that the new message better matches the line above it in the test output. Differential Revision: https://phab.mercurial-scm.org/D12154
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 07 Feb 2022 22:54:38 -0800
parents d169e651066b
children 6000f5b25c9b
comparison
equal deleted inserted replaced
48762:d169e651066b 48763:93d6f0e7ba2f
419 # restore local 419 # restore local
420 if localkey != self._repo.nodeconstants.nullhex: 420 if localkey != self._repo.nodeconstants.nullhex:
421 self._restore_backup(wctx[dfile], localkey, flags) 421 self._restore_backup(wctx[dfile], localkey, flags)
422 else: 422 else:
423 wctx[dfile].remove(ignoremissing=True) 423 wctx[dfile].remove(ignoremissing=True)
424
425 if not fco.cmp(fcd): # files identical?
426 # If return value of merge is None, then there are no real conflict
427 del self._state[dfile]
428 self._results[dfile] = None, None
429 self._dirty = True
430 return None
431
424 merge_ret, deleted = filemerge.filemerge( 432 merge_ret, deleted = filemerge.filemerge(
425 self._repo, 433 self._repo,
426 wctx, 434 wctx,
427 self._local, 435 self._local,
428 lfile, 436 lfile,
429 fcd, 437 fcd,
430 fco, 438 fco,
431 fca, 439 fca,
432 labels=self._labels, 440 labels=self._labels,
433 ) 441 )
434 if merge_ret is None:
435 # If return value of merge is None, then there are no real conflict
436 del self._state[dfile]
437 self._results[dfile] = None, None
438 self._dirty = True
439 return None
440 442
441 if not merge_ret: 443 if not merge_ret:
442 self.mark(dfile, MERGE_RECORD_RESOLVED) 444 self.mark(dfile, MERGE_RECORD_RESOLVED)
443 445
444 action = None 446 action = None