[PATCH 2 of 2] tests: simplify and clarify test-obsolete-bundle-strip.t a little
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sat Jun 3 16:08:15 UTC 2017
On 06/03/2017 06:01 PM, Martin von Zweigbergk via Mercurial-devel wrote:
>
>
> On Jun 3, 2017 8:22 AM, "Yuya Nishihara" <yuya at tcha.org
> <mailto:yuya at tcha.org>> wrote:
>
> On Sat, 03 Jun 2017 00:35:19 -0700, Martin von Zweigbergk via
> Mercurial-devel wrote:
> > # HG changeset patch
> > # User Martin von Zweigbergk <martinvonz at google.com
> <mailto:martinvonz at google.com>>
> > # Date 1496469903 25200
> > # Fri Jun 02 23:05:03 2017 -0700
> > # Node ID ff06148cbf34428d71bd7ea9d2e31fa806686417
> > # Parent f782e04fb7d18868cf7da00a41aaa8f15c8e8802
> > tests: simplify and clarify test-obsolete-bundle-strip.t a little
> >
> > diff --git a/tests/test-obsolete-bundle-strip.t
> b/tests/test-obsolete-bundle-strip.t
> > --- a/tests/test-obsolete-bundle-strip.t
> > +++ b/tests/test-obsolete-bundle-strip.t
> > @@ -76,8 +76,8 @@
> > > echo '### Exclusive markers ###'
> > > cat "${exclufile}"
> > > # if the matched revs do not have children, we also check
> the result of strip
> > - > orphan=`hg log --hidden -T '.\n' --rev "(not (${revs}))
> and (${revs}::)" | wc -l | sed -e 's/ //g'`
> > - > if [ $orphan -eq 0 ];
> > + > children=`hg log --hidden -T . --rev "(${revs}::) -
> (${revs})" | wc -c`
> > + > if [ $children -eq 0 ];
>
> Perhaps this can be simplified further. drop "wc -c" and test [ -z
> "$children" ].
>
>
> Yes, I considered that but thought that maybe Pierre-Yves wanted the
> faster '.' template. But that's a pretty silly optimization to do in a
> test, so I'll do as you suggested in the next version.
Yuya version seems fine. No real optimization concerns here, I just took
the "counting number of changeset matching a revset" pattern of the
shelve of my mental library without thinking too hard. Thanks for the
clean up. The test update looks good.
(+1 to yuya pointing out the other ${rev} needs () too)
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list