D3644: state: raise CorruptedState error isntead of ProgrammingError

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue May 22 21:52:41 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  There are old state files which don't have a version number in top of them and
  hence we have to read them to check whether they are good or not.
  ProgrammingError is not apt for this case. Thanks to Yuya for suggesting
  CorruptedState error.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -72,8 +72,8 @@
             try:
                 int(fp.readline())
             except ValueError:
-                raise error.ProgrammingError("unknown version of state file"
-                                             " found")
+                raise error.CorruptedState("unknown version of state file"
+                                           " found")
             return cbor.load(fp)
 
     def delete(self):



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


More information about the Mercurial-devel mailing list