Patchwork convert: test clean p2 file missing

login
register
mail settings
Submitter Mads Kiilerich
Date Oct. 24, 2015, 12:18 a.m.
Message ID <d6bf0a037c0783539daa.1445645882@localhost.localdomain>
Download mbox | patch
Permalink /patch/11226/
State Accepted
Commit e24eee55c12945d6d41c1f563fe550a72c1d5d27
Headers show

Comments

Mads Kiilerich - Oct. 24, 2015, 12:18 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@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@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.
Mads Kiilerich - Oct. 24, 2015, 12:22 a.m.
Right.

I convinced myself that existing changes implemented a correct solution 
to the problem I experienced. I would however like to add test coverage 
for it so it stays fixed.

(I notice a75d24539aba didn't introduce test coverage for the Abort it 
introduced and wonder how good the general test coverage of it is.)

/Mads


On 10/24/2015 02:18 AM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@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@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
> +  $ cd ..
Mads Kiilerich - Oct. 24, 2015, 12:34 a.m.
On 10/24/2015 02:18 AM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@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@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
Durham Goode - Oct. 28, 2015, 9:11 p.m.
On 10/23/15, 5:34 PM, "Mads Kiilerich" <mads@kiilerich.com> wrote:

>On 10/24/2015 02:18 AM, Mads Kiilerich wrote:

>> # HG changeset patch

>> # User Mads Kiilerich <madski@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@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?
Matt Mackall - Nov. 2, 2015, 8:25 p.m.
On Sat, 2015-10-24 at 02:18 +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@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

Queued for default, thanks.

-- 
Mathematics is the supreme nostalgia of our time.

Patch

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
+  $ cd ..