[darcs-users] darcs patch: resolve issue1111: use correct side of return from?partitionRL

David Roundy droundy at darcs.net
Sat Oct 4 12:19:53 UTC 2008


On Sat, Oct 04, 2008 at 02:01:28PM +0200, Tommy Pettersson wrote:
> This fix being in Darcs/Patch/ makes me a bit uncomfortable, but
> it should be rather straight forward. From reading the code for
> partitionRL it is clear it puts the interesting (common, in this
> case) patches to the right, but patchset_intersection wrongly
> picked the left side (which would have been the complement of
> common patches from one of the sets).
> 
> 
> Sat Oct  4 01:12:44 CEST 2008  Tommy Pettersson <ptp at lysator.liu.se>
>   * resolve issue1111: use correct side of return from partitionRL
> 
> Sat Oct  4 01:03:23 CEST 2008  Tommy Pettersson <ptp at lysator.liu.se>
>   * use longer patch names in issue1111 test for safer grep result
>   The 'not grep C out' found the author--date line of patch A, which
>   contained my timezone (CEST), so the test failed even when it should have
>   succeeded.
> 
> 

> Sat Oct  4 01:03:23 CEST 2008  Tommy Pettersson <ptp at lysator.liu.se>
>   * use longer patch names in issue1111 test for safer grep result
>   The 'not grep C out' found the author--date line of patch A, which
>   contained my timezone (CEST), so the test failed even when it should have
>   succeeded.
> 
> Sat Oct  4 01:12:44 CEST 2008  Tommy Pettersson <ptp at lysator.liu.se>
>   * resolve issue1111: use correct side of return from partitionRL
> 
> New patches:
> 
> [use longer patch names in issue1111 test for safer grep result
> Tommy Pettersson <ptp at lysator.liu.se>**20081003230323
>  The 'not grep C out' found the author--date line of patch A, which
>  contained my timezone (CEST), so the test failed even when it should have
>  succeeded.
> ] hunk ./bugs/issue1111-pull-intersection.sh 16
>  darcs initialize
>  echo A > A
>  darcs add A
> -darcs record -a -m A
> +darcs record -a -m Aismyname
>  echo B > B
>  darcs add B
> hunk ./bugs/issue1111-pull-intersection.sh 19
> -darcs record -a -m B
> +darcs record -a -m Bismyname
>  
>  cd ..
>  darcs get temp1 temp2
> hunk ./bugs/issue1111-pull-intersection.sh 28
>  darcs obliterate --last 1 -a
>  echo C > C
>  darcs add C
> -darcs record -a -m C
> +darcs record -a -m Cismyname
>  cd ..
>  
>  mkdir temp3
> hunk ./bugs/issue1111-pull-intersection.sh 38
>  
>  darcs changes > out
>  cat out
> -grep A out
> -not grep B out
> -not grep C out
> +grep Aismyname out
> +not grep Bismyname out
> +not grep Cismyname out
>  cd ..
>  
>  rm -rf temp1 temp2 temp3
> [resolve issue1111: use correct side of return from partitionRL
> Tommy Pettersson <ptp at lysator.liu.se>**20081003231244] move ./bugs/issue1111-pull-intersection.sh ./tests/issue1111-pull-intersection.sh
> hunk ./src/Darcs/Patch/Depends.lhs 483
>            case mapRL info a `intersect` mapRL info b of
>            morecommon -> 
>                case partitionRL (\e -> info e `elem` morecommon) a of
> -                commonps :> _ -> seal $ commonps :<: common
> +                _ :> commonps -> seal $ commonps :<: common


Ah, this change isn't quite right (and would have been caught by the type
witnesses on push).  The problem is that partitionRL returns two ordered
sequences of patches, and the right-hand one is after the left-hand one, so
you can't sequence it with common as you do.  The correct fix (apparently)
is to change `elem` to `notElem` to reverse the meaning of the two outputs
(but retain them in the proper order).  Tommy, I'll let you make this
change, so you get the credit, since you're the one who tracked this down.

And I'll apply the test patch now.  I should have known better than to use
single-characters like that.

David


More information about the darcs-users mailing list