[PATCH 1 of 7 clfilter part 1 V3] clfilter: ensure context raise RepoLookupError when the revision is filtered

Pierre-Yves David pierre-yves.david at logilab.fr
Mon Dec 17 13:00:11 CST 2012


On Mon, Dec 17, 2012 at 10:58:09AM -0600, Sean Farley wrote:
> On Mon, Dec 17, 2012 at 10:50 AM,  <pierre-yves.david at logilab.fr> wrote:
> > # HG changeset patch
> > # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> > # Date 1354489919 -3600
> > # Node ID e954ac5321a9ead1a4e687385dca7134218ccc83
> > # Parent  8c9a52492d426741ab24392d49f44a1d4f23613e
> > clfilter: ensure context raise RepoLookupError when the revision is filtered
> >
> > Currently the code path of `changectx(filteredrepo, rev)` call
> > `filteredrepo.changelog.node(rev)`. When `rev` is filtered this raise an
> > unhandled `IndexError`. This case now raise a `RepoLookupError` as other
> > error case do.
> >
> > diff --git a/mercurial/context.py b/mercurial/context.py
> > --- a/mercurial/context.py
> > +++ b/mercurial/context.py
> > @@ -23,10 +23,15 @@ class changectx(object):
> >          if changeid == '':
> >              changeid = '.'
> >          self._repo = repo
> >
> >          if isinstance(changeid, int):
> > +            try:
> > +                self._node = repo.changelog.node(changeid)
> > +            except IndexError:
> > +                raise error.RepoLookupError(
> > +                    _("unknown revision '%s'") % changeid)
> >              self._rev = changeid
> >              self._node = repo.changelog.node(changed)
> 
> Not a big deal, but did you mean to leave this duplicated 'self._node
> = repo.changelog.node(changed)' after your try/except clause?

Fixed version can be pulled from

hg pull -r c68a4c3cfe81 http://hg-lab.logilab.org/wip/hg-filter/


-- 
Pierre-Yves David

http://www.logilab.fr/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121217/c1f27783/attachment.pgp>


More information about the Mercurial-devel mailing list