[PATCH STABLE] strip: fix revset usage (issue3604)
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Aug 31 21:33:54 UTC 2012
On 31 août 2012, at 23:18, Benoit Boissinot wrote:
> FYI
>
> On Fri, Aug 31, 2012 at 9:39 PM, Augie Fackler <raf at durin42.com> wrote:
> It sounds like we should have some kind of "revsets for internal code" best practices somewhere?
>
> On Aug 31, 2012, at 2:25 PM, Pierre-Yves David wrote:
>
> > # HG changeset patch
> > # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> > # Date 1346440830 -7200
> > # Branch stable
> > # Node ID 8f5348657f23c0bb66625a64c792a0dba97659ef
> > # Parent b0aad9fb87f947e821f0381d461f1794e73833a7
> > strip: fix revset usage (issue3604)
> >
> > The `repair` code builds a giant revset query instead of using the "%lr" idiom.
> > It is inefficient and crash when the number of stripped changeset is too big.
> >
> > This changeset replaces the bad code by a better revset usage.
> >
> > diff --git a/mercurial/repair.py b/mercurial/repair.py
> > --- a/mercurial/repair.py
> > +++ b/mercurial/repair.py
> > @@ -111,9 +111,10 @@
> > saverevs.difference_update(descendants)
> > savebases = [cl.node(r) for r in saverevs]
> > stripbases = [cl.node(r) for r in tostrip]
> > - rset = ' or '.join([str(r) for r in tostrip])
> > - newbmtarget = repo.revs('sort(heads(ancestors(%r) - (%r)), -rev)',
> > - rset, rset)
> > +
> > + touched = saverevs | tostrip
> > + newbmtarget = repo.revs('sort(heads((::%ld) - (%ld)), -rev)',
> > + touched, touched)
>
> Should use tostrip here, instead of created touched.
Woops, my bad. I resent a fixed version. Thanks for reviewing this !
--
Pierre-Yves
More information about the Mercurial-devel
mailing list