resolve: fix mark-check when a file was deleted on one side (issue6020)
ClosedPublic

Authored by spectral on Nov 7 2018, 6:45 PM.

Details

Summary

wvfs.open raises an error if one of the files does not exist. Ignoring the error
if it's ENOENT is done in several other places in this code, so I'm in good
company :)

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped
spectral created this revision.Nov 7 2018, 6:45 PM
yuja added a subscriber: yuja.Nov 8 2018, 6:45 AM
  • with repo.wvfs(f) as fobj:
  • fdata = fobj.read() + try: + with repo.wvfs(f) as fobj: + fdata = fobj.read() + except (IOError, OSError) as inst: + if inst.errno != errno.ENOENT: + raise

'fdata' can be undefined here. Appears that the test doesn't go through this
case.

Perhaps, wvfs.tryread() can be used instead.

if filemerge.hasconflictmarkers(fdata) and \
    ms[f] != mergemod.MERGE_RECORD_RESOLVED:
    hasconflictmarkers.append(f)
spectral planned changes to this revision.Nov 13 2018, 9:23 PM

(not sure when I'll get to the changes, but removing from Needs Review, sorry I delayed so long doing that)

spectral updated this revision to Diff 13298.Jan 16 2019, 3:49 PM

Alright that test seems a bit ridiculous now that I'm looking at it in the diff, but it's at least thorough? :)

yuja added a comment.Thu, Jan 17, 8:17 AM

Queued, thanks.

Replaced all [[ -f ]] with [ -f ]. `[[]]` requires Bash.

This revision was automatically updated to reflect the committed changes.