D1340: dirstate: add explicit methods for modifying dirstate

mbthomas (Mark Thomas) phabricator at mercurial-scm.org
Sat Nov 11 08:04:59 EST 2017


mbthomas added inline comments.

INLINE COMMENTS

> mbolin wrote in dirstate.py:1275
> To avoid doing two lookups in `self._map`:
> 
>   try:
>       self._map.pop(f)
>       return True
>   except KeyError:
>       return False

Good idea.  I think `return self._map.pop(f, None) is not None` would avoid two lookups and also the exception.  This function's going to be getting more complex in later diffs, so I'd like to avoid an exception handler if possible.

REPOSITORY
  rHG Mercurial

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

To: mbthomas, #hg-reviewers, durin42
Cc: durin42, mbolin, mercurial-devel


More information about the Mercurial-devel mailing list