[PATCH 2 of 7] test-obsolete-bundle-strip: add testing of markers backup during strip

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Jun 3 12:09:57 EDT 2017



On 06/03/2017 08:25 AM, Martin von Zweigbergk via Mercurial-devel wrote:
> On Fri, Jun 2, 2017 at 11:10 PM, Martin von Zweigbergk
> <martinvonz at google.com> wrote:
>> On Thu, Jun 1, 2017 at 6:39 AM, Pierre-Yves David
>> <pierre-yves.david at ens-lyon.org> wrote:
>>> # HG changeset patch
>>> # User Pierre-Yves David <pierre-yves.david at octobus.net>
>>> # Date 1495763531 -7200
>>> #      Fri May 26 03:52:11 2017 +0200
>>> # Node ID 441ba7c32dd493207066bc1a84fa6a6a759b0971
>>> # Parent  a9f5b20c68a41d7b2760e7f986c0968913d7c5bb
>>> # EXP-Topic obsstrip
>>> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
>>> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 441ba7c32dd4
>>> test-obsolete-bundle-strip: add testing of markers backup during strip
>>>
>>> When applicable, we strip the revision tested in the test and we check that the
>>> backup bundle contains the appropriate markers.
>>>
>>> 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
>>> @@ -2,9 +2,6 @@
>>>  Test obsmarkers interaction with bundle and strip
>>>  ==================================================
>>>
>>> -The file currently only contains test for bundle.
>>> -Testing of strip will happen some time soon (tm).
>>> -
>>>  Setup a repository with various case
>>>  ====================================
>>>
>>> @@ -50,7 +47,7 @@ Config setup
>>>    > }
>>>
>>>  Function to compare the expected bundled obsmarkers with the actually bundled
>>> -obsmarkers.
>>> +obsmarkers. It also check the obsmarkers backed up during strip.
>>>
>>>    $ testrevs () {
>>>    >     revs="$1"
>>> @@ -60,6 +57,7 @@ obsmarkers.
>>>    >     markersfile="${prefix}-relevant-markers.txt"
>>>    >     bundlefile="${prefix}-bundle.hg"
>>>    >     contentfile="${prefix}-bundle-markers.hg"
>>> +  >     stripcontentfile="${prefix}-bundle-markers.hg"
>>>    >     hg debugobsolete --hidden --rev "${revs}" | sed 's/^/    /' > "${markersfile}"
>>>    >     echo '### Matched revisions###'
>>>    >     hg log --hidden --rev "${revs}" | sort
>>> @@ -73,6 +71,22 @@ obsmarkers.
>>>    >     echo '### diff <relevant> <bundled> ###'
>>>    >     cmp "${markersfile}" "${contentfile}" || diff -u "${markersfile}" "${contentfile}"
>>>    >     echo '#################################'
>>> +  >     # 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'`
>
> More importantly than the below, the "(not ${revs})" needs an extra
> pair of parens around ${revs}. Currently some tests do "testrevs A +
> B" and this becomes "(not A + B)" when it was mean to be "(not (A +
> B))". I'll fix that in the followup too.

Good catch!

>> nit: Someone with no children is not (necessarily) an orphan.
>> "children" (or "numchildren") would make more sense. It's just a test
>> case, so not very important, but I'll send a followup patch.
>>
>> Also, what's the "sed" for?

Checkcode was complaining about the lack of it. I copied the way another 
test was doing it.

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list