This revision was automatically updated to reflect the committed changes. Closed by commit rHGad8389ecd3f5: storageutil: consistently raise LookupError (API) (authored by indygreg, committed by ).
REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4798?vs=11481&id=11612 REVISION DETAIL https://phab.mercurial-scm.org/D4798 AFFECTED FILES mercurial/testing/storage.py mercurial/utils/storageutil.py CHANGE DETAILS diff --git a/mercurial/utils/storageutil.py b/mercurial/utils/storageutil.py --- a/mercurial/utils/storageutil.py +++ b/mercurial/utils/storageutil.py @@ -121,7 +121,10 @@ Raises ``error.LookupError`` on failure. """ if isinstance(fileid, int): - return store.node(fileid) + try: + return store.node(fileid) + except IndexError: + raise error.LookupError(fileid, identifier, _('no match found')) if len(fileid) == 20: try: diff --git a/mercurial/testing/storage.py b/mercurial/testing/storage.py --- a/mercurial/testing/storage.py +++ b/mercurial/testing/storage.py @@ -199,13 +199,13 @@ with self.assertRaises(error.LookupError): f.lookup(hex(node)[0:12]) - with self.assertRaises(IndexError): + with self.assertRaises(error.LookupError): f.lookup(-2) with self.assertRaises(error.LookupError): f.lookup(b'-2') - with self.assertRaises(IndexError): + with self.assertRaises(error.LookupError): f.lookup(1) with self.assertRaises(error.LookupError): To: indygreg, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel