[merge] faster knit extraction & better errors if unable to get delta parent

Martin Pool mbp at sourcefrog.net
Tue Oct 23 07:26:04 BST 2007


> > +                    try:
> > +                        next = parents[0]
> > +                    except IndexError:
> > +                        raise KnitCorrupt(
> > +                            self,
> > +                            "\nversion %s\n"
> > +                            "    has compression method %r " \
> > +                            "but index parents %r " % (
> > +                            cursor, method, parents))
> > +                    next = parents[0]
>
> However this isn't - for two reasons.
> The first is that it was triggering before because get_parents was
> reducing the parents by removing absent keys, and
> get_parents_with_ghosts won't do that, so you will need a index with no
> parents at all to trigger this for that record.
> Secondly, there is a cost for exception contexts, and this is right in
> an inner loop, so I would actually expect this to cost performance
> as-is.

Although this will no longer trip for the particular problem we had
now, it seemed still worth leaving it in to guard against other(?)
situations where we might have a delta with no parents present.  In
packs it's probably hard to get a line delta indicated without having
any parents, so the time cost is not worth it.

-- 
Martin



More information about the bazaar mailing list