D2596: state: raise ProgrammingError if an invalid key is being accessed

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sun Mar 4 12:47:33 EST 2018


yuja added a comment.


  In https://phab.mercurial-scm.org/D2596#42678, @pulkit wrote:
  
  > In https://phab.mercurial-scm.org/D2596#42672, @durin42 wrote:
  >
  > > Hmm, really? Do any states have optional entries that would make this awkward?
  >
  >
  > Nope, but I wanted to be safe here raising a ProgrammingError instead of KeyError.
  
  
  I don't follow, but what if the state file was written by old hg client where some new keys
  were missing, and read by new client? Perhaps we'll have to support that scenario.

INLINE COMMENTS

> state.py:61
> +        except KeyError:
> +            raise error.ProgrammingError(_("key '%s' not found in state"
> +                                           " file %s") % (key, self.path))

Nit: no need to make a ProgrammingError translatable.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers
Cc: yuja, durin42, mercurial-devel


More information about the Mercurial-devel mailing list