D758: dirstate: move parent reading to the dirstatemap class

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sun Sep 24 11:25:20 EDT 2017


indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  Lots of comments. But nothing that should warrant blocking.

INLINE COMMENTS

> dirstate.py:1370
> +            st = fp.read(40)
> +            fp.close()
> +            l = len(st)

Nit: this should ideally be in a context manager or try..finally block. But it existed this way before, so not worth blocking over.

> dirstate.py:1375
> +            elif l > 0 and l < 40:
> +                raise error.Abort(_('working directory state appears damaged!'))
> +        except IOError as err:

Another pre-existing poor error message because it isn't actionable :/

> dirstate.py:1376-1378
> +        except IOError as err:
> +            if err.errno != errno.ENOENT:
> +                raise

Idea for follow-up: a vfs layer that operates on pending files. Maybe we could pass `pending=True` somewhere? That way we can use `vfs.tryread()` instead of this low-level code. Not sure if we have enough consumers to warrant that though.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D758

To: durham, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list