[PATCH 2 of 2] localrepo: use ProgrammingError

Augie Fackler raf at durin42.com
Tue Dec 6 16:18:46 EST 2016


On Tue, Dec 06, 2016 at 08:02:11PM +0000, Kostia Balytskyi wrote:
> Both patches look good to me.

Agreed. Queued, thanks.

>
> On 12/6/16 5:13 PM, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1481043999 0
> > #      Tue Dec 06 17:06:39 2016 +0000
> > # Node ID 5197933cb8b90a976be3d298b5f51b154fd8e733
> > # Parent  67bcd43e64ca03f486a817fccf38e83020b06793
> > # Available At https://bitbucket.org/quark-zju/hg-draft
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 5197933cb8b9
> > localrepo: use ProgrammingError
> >
> > This is an example usage of ProgrammingError. Let's start migrating
> > RuntimeError to ProgrammingError.
> >
> > The code only runs when devel.all-warnings or devel.check-locks is set, so
> > it does not affect the end-user experience.
> >
> > diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> > --- a/mercurial/localrepo.py
> > +++ b/mercurial/localrepo.py
> > @@ -1017,6 +1017,5 @@ class localrepository(object):
> >                   or self.ui.configbool('devel', 'check-locks')):
> >               if self._currentlock(self._lockref) is None:
> > -                raise RuntimeError('programming error: transaction requires '
> > -                                   'locking')
> > +                raise error.ProgrammingError('transaction requires locking')
> >           tr = self.currenttransaction()
> >           if tr is not None:
> > diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
> > --- a/tests/test-devel-warnings.t
> > +++ b/tests/test-devel-warnings.t
> > @@ -175,5 +175,5 @@ Test programming error failure:
> >     ** Extensions loaded: * (glob)
> >     Traceback (most recent call last):
> > -  RuntimeError: programming error: transaction requires locking
> > +  mercurial.error.ProgrammingError: transaction requires locking
> >
> >     $ cd ..
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list