D759: dirstate: move parents source of truth to dirstatemap
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Sun Sep 24 11:33:10 EDT 2017
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.
The logic here isn't readable enough that IMO we should fix it in flight.
INLINE COMMENTS
> dirstate.py:1382-1383
> + raise
> + if not self._parents:
> + self._parents = [nullid, nullid]
> +
This code doesn't read very cleanly.
The only cases where `self._parents` won't be set here are if the file exists but is empty or the file doesn't exist. I'd rather make that logic explicit and `assert self._parents` here.
Note that if the code were changed so an empty string represented both missing and empty files, the resulting code would be pretty clear via a //switch// statement against the content length.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D759
To: durham, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
More information about the Mercurial-devel
mailing list