[PATCH] convert: test clean p2 file missing

Durham Goode durham at fb.com
Wed Oct 28 16:11:49 CDT 2015






On 10/23/15, 5:34 PM, "Mads Kiilerich" <mads at kiilerich.com> wrote:

>On 10/24/2015 02:18 AM, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski at unity3d.com>
>> # Date 1445644486 -7200
>> #      Sat Oct 24 01:54:46 2015 +0200
>> # Branch stable
>> # Node ID d6bf0a037c0783539daaab3e90ded59b2b2a6caf
>> # Parent  39dbf495880b8a439d912091109427d27a7e616a
>> convert: test clean p2 file missing
>>
>> 216fa1ba9993 introduced "clever" reuse of p2 but did that convert could fail
>> with
>>    abort: f1 at f73e02ae52c5: not found in manifest!
>> when it tried to reuse a file from p2 but the file didn't exist there, for
>> example because filemap changes.
>>
>> 5ca587348875 fixed that (using changes from a75d24539aba), but with a quite
>> different reasoning and test case.
>>
>> Add another test that makes sure this case is covered too.
>>
>> diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t
>> --- a/tests/test-convert-filemap.t
>> +++ b/tests/test-convert-filemap.t
>> @@ -740,4 +740,49 @@ test converting merges into a repo that
>>        - converted/a
>>        - toberemoved
>>     
>> +  $ cd ..
>>   
>> +
>> +Test case where cleanp2 contains a file that doesn't exist in p2 - for
>> +example because filemap changed.
>> +
>> +  $ hg init cleanp2
>> +  $ cd cleanp2
>> +  $ touch f f1 f2 && hg ci -Aqm '0'
>> +  $ echo f1 > f1 && echo >> f && hg ci -m '1'
>> +  $ hg up -qr0 && echo f2 > f2 && echo >> f && hg ci -qm '2'
>> +  $ echo "include f" > filemap
>> +  $ hg convert --filemap filemap .
>> +  assuming destination .-hg
>> +  initializing destination .-hg repository
>> +  scanning source...
>> +  sorting...
>> +  converting...
>> +  2 0
>> +  1 1
>> +  0 2
>> +  $ hg merge && hg ci -qm '3'
>> +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> +  (branch merge, don't forget to commit)
>> +  $ echo "include ." > filemap
>> +  $ hg convert --filemap filemap .
>> +  assuming destination .-hg
>> +  scanning source...
>> +  sorting...
>> +  converting...
>> +  0 3
>> +  $ hg -R .-hg log -G -T '{shortest(node)} {desc}\n{files % "- {file}\n"}\n'
>> +  o    e9ed 3
>> +  |\
>> +  | o  33a0 2
>> +  | |  - f
>> +  | |
>> +  o |  f73e 1
>> +  |/   - f
>> +  |
>> +  o  d681 0
>> +     - f
>> +
>> +  $ hg -R .-hg mani -r tip
>> +  f
>
>I am not entirely convinced that it is correct behaviour that the merge 
>of revision 1 on top of revision 2 in changeset 3 doesn't introduce f1 
>... and by symmetry also f2.
>
>/Mads

The test looks good to me.  I agree the semantics in this case are a bit weird, but convert's contract has always been 'applies the changes in that commit to the destination', and in this case there are no changes. Did this test result in something different before my changes?


More information about the Mercurial-devel mailing list