[PATCH 4 of 6] verify: avoid exception on missing file revlog
Matt Mackall
mpm at selenic.com
Tue Apr 21 21:09:10 UTC 2009
On Tue, 2009-04-21 at 15:57 -0400, Brodie Rao wrote:
> On Apr 21, 2009, at 1:33 PM, Henrik Stuart wrote:
>
> > # HG changeset patch
> > # User Henrik Stuart <hg at hstuart.dk>
> > # Date 1240224937 -7200
> > # Node ID 67570c919a84ff2d067af019a47beb8a2ac97ded
> > # Parent bdd6ec1c2f1c66ef7afc7ae7ce1bc503ede12c9f
> > verify: avoid exception on missing file revlog
> >
> > Previously, accessing the filelinkrevs of a specific file that
> > happens to
> > have already been unlinked from the filesystem, e.g. due to a
> > partial rollback
> > having occurred, will trigger a KeyError being raised.
> >
> > Co-contributor: Sune Foldager <cryo at cyanite.org>
> >
> > diff -r bdd6ec1c2f1c -r 67570c919a84 mercurial/verify.py
> > --- a/mercurial/verify.py Sun Apr 19 20:02:32 2009 +0200
> > +++ b/mercurial/verify.py Mon Apr 20 12:55:37 2009 +0200
> > @@ -173,6 +173,10 @@
> >
> > files = util.sort(util.unique(filenodes.keys() +
> > filelinkrevs.keys()))
> > for f in files:
> > + if not filelinkrevs.has_key(f):
>
> Could you use "if f in filelinkrevs:" instead? dict.has_key is
> deprecated in Python 2.6, and the in keyword is a bit more readable.
Yes, please. We are not fans of has_key. It's even got an inconsistent
underbar.
--
http://selenic.com : development and support for Mercurial and Linux
More information about the Mercurial-devel
mailing list