[PATCH] Add script to rewrite manifest to workaround lack of parent deltas

Benoit Boissinot benoit.boissinot at ens-lyon.org
Mon Aug 24 16:39:04 CDT 2009


On Mon, Aug 24, 2009 at 05:06:49PM -0400, Greg Ward wrote:
> On Mon, Aug 24, 2009 at 12:26 PM, Benoit
> Boissinot<benoit.boissinot at ens-lyon.org> wrote:
> > On Fri, Aug 21, 2009 at 06:18:02PM -0400, Greg Ward wrote:
> >> # HG changeset patch
> >> # User Greg Ward <greg-hg at gerg.ca>
> >> # Date 1233047576 0
> >> # Node ID 4b03b395c5923319c1d9986ab47e6e3d99bfc6f8
> >> # Parent  b47fa638bfc7d6e5185f49113a6c418fbe6cf0b3
> >> Add script to rewrite manifest to workaround lack of parent deltas.
> >
[snip]
> >> +    indexfn = repo.join('store/00manifest.i')
> >> +    datafn = indexfn[:-2] + '.d'
> >> +    if not os.path.exists(datafn):
> >> +        sys.exit('error: %s does not exist: manifest not big enough '
> >> +                 'to be worth shrinking' % datafn)
> >> +
> >
> > I've found the warning annoying so I changed it like this:
> >
> >> +    oldindexfn = indexfn + '.old'
> >> +    olddatafn = datafn + '.old'
> >
> >    oldindexfn = tempfile.mktemp(dir=repo.sjoin(''),
> >                                 prefix='00manifest.',
> >                                 suffix='.i.old')
> >    olddatafn = oldindexfn[:-6] + '.d.old'
> 
> 1) except tempfile.mktemp() is unsafe and should not be used

Not more unsafe than using a chosen prefix.

> 2) I don't understand how this avoids reading a 00manifest.d that does not exist

That was about the warning below that actually (when I was trying to
launch the script with a .old sitting around).
> 
> >> +    if os.path.exists(oldindexfn) or os.path.exists(olddatafn):
> >> +        sys.exit('error: one or both of %s or %s exists from a previous run; '
> >> +                 'please clean up before running again'
> >> +                 % (oldindexfn, olddatafn))
> >> +
> >
> > Final note: If someone wants to do that, the script could accept
> > arbitrary revlogs as arguments, except the changelog (because it would
> > need fixing the linkrevs).
> 
> Running this on an arbitrary revlog -- really, a filelog -- smells
> like YAGNI to me.

(what does YAGNI means?)

> I mean, yeah, sure, lack of parent deltas can cause
> any revlog to be larger than it should be.  But most complaints are
> about giant manifest files.

Yeah that was more a remark in case people would want to try it in other
revlogs: "you should never run this script on the changelog!"

regards,

Benoit

-- 
:wq


More information about the Mercurial-devel mailing list