Pier - Problems moving pages

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Pier - Problems moving pages

John Borden
All,
One of the most impressive things I see about pier is the ability to  
move pages around.  A few days ago, I found that if I moved a page,  
then edited it, all of the links on the page were broken.  A three  
page test would be:
   root - Root has children *folder* and *command*
     folder - Folder has a *parent>../.* and a  *sibling/child>../
command*
     command - Command has a *root>../.* and a  *sibling/parent>../
folder*

If command is moved from being a child of root to being a child of  
folder, then when it is edited, the link will not be updated to  
*root>../..* and *sibling/parent>../..*.

If we add the following to the bottom of PRMoveCommand>>doExecute,  
then it removes this problem:

   self structure enumerator everything do: [:e |  
(PROutgoingReferences on: e) do: [:link | link update ]]

This evening, I wrote a test case, and tested this with some older  
code, but when I load Pier-model 300 and Pier tests 129, about a  
dozen tests fail and there an issue with a DNU in  
PRPathReference>>setTarget:, if someone is changing the Pier-Model,  
could you add this test:

PRMoveCommandTest>>testMoveIntoFolderCheckContents
        "Taken from #testMoveIntoFolder"
        self command
                target: (self command root childrenDecoration at: 'folder').
        self kernel root contents: 'Before root has two children, *folder*  
and *command*.  After will be one child named folder, which has a  
child command'.
        (self kernel root childrenDecoration at: 'folder')
                contents: 'Folder has a *parent>../* and a  *sibling/child>../
command*.'.
        (self kernel root childrenDecoration at: 'command')
                contents: 'Command has a *root parent>../* and a  *sibling/
parrent>../folder*.'.
        self deny: (self kernel root enumerator everything
                        anySatisfy: [:e | (PROutgoingReferences on: e)
                                        anySatisfy: [:link | link isBroken]]).
        self
                shouldnt: [self command execute]
                raise: PRStructureError.
        self
                assert: (self command root contents includesSubString: 'two  
children, *folder* and *folder/command*.').
        self
                assert: ((self command root childrenDecoration at: 'folder')  
contents includesSubString: 'has a *parent>../* and a  *sibling/
child>command*.').
        self
                assert: (((self command root childrenDecoration at: 'folder')  
childrenDecoration at: 'command') contents includesSubString:  
'Command has a *root parent>../..* and a  *sibling/parrent>..*.')

Thanks,
John
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier - Problems moving pages

Lukas Renggli
Thank you for submitting this test case. I know that the link-updating
is not as well tested as it should. The method that does all the
update magic is the following one. I recently fixed a problem there,
so it is good that somebody has a look at it. The relevant method is
the following and called with the structure that was moved or copied:

PRLocationCommand>>#updateLinksFor: aStructure
        | structures |
        structures := aStructure enumerator
                everything contents.
        structures do: [ :structure |
                structure outgoingReferences
                        do: [ :link | link update ] ].
        aStructure root incomingReferences
                toAll: structures;
                do: [ :link | link update ]

First of all it builds a collection of the receiver an all its nested
children and updates all their links. Then it updates all the
references in the complete system that point to any structure in the
collection. Am I missing something?

Without touching other code your test passes in the latest Pier. Also
I could not reproduce the problem in the web browser. Are you sure
that you have all the latest versions of the relevant packages loaded?
In my image there is a method called PRPathReference>>#setTarget:.

Cheers,
Lukas

On Wed, Apr 22, 2009 at 6:15 AM, John Borden <[hidden email]> wrote:

> All,
> One of the most impressive things I see about pier is the ability to move
> pages around.  A few days ago, I found that if I moved a page, then edited
> it, all of the links on the page were broken.  A three page test would be:
>  root - Root has children *folder* and *command*
>    folder - Folder has a *parent>../.* and a  *sibling/child>../command*
>    command - Command has a *root>../.* and a  *sibling/parent>../folder*
>
> If command is moved from being a child of root to being a child of folder,
> then when it is edited, the link will not be updated to *root>../..* and
> *sibling/parent>../..*.
>
> If we add the following to the bottom of PRMoveCommand>>doExecute, then it
> removes this problem:
>
>  self structure enumerator everything do: [:e | (PROutgoingReferences on: e)
> do: [:link | link update ]]
>
> This evening, I wrote a test case, and tested this with some older code, but
> when I load Pier-model 300 and Pier tests 129, about a dozen tests fail and
> there an issue with a DNU in PRPathReference>>setTarget:, if someone is
> changing the Pier-Model, could you add this test:
>
> PRMoveCommandTest>>testMoveIntoFolderCheckContents
>        "Taken from #testMoveIntoFolder"
>        self command
>                target: (self command root childrenDecoration at: 'folder').
>        self kernel root contents: 'Before root has two children, *folder*
> and *command*.  After will be one child named folder, which has a child
> command'.
>        (self kernel root childrenDecoration at: 'folder')
>                contents: 'Folder has a *parent>../* and a
>  *sibling/child>../command*.'.
>        (self kernel root childrenDecoration at: 'command')
>                contents: 'Command has a *root parent>../* and a
>  *sibling/parrent>../folder*.'.
>        self deny: (self kernel root enumerator everything
>                        anySatisfy: [:e | (PROutgoingReferences on: e)
>                                        anySatisfy: [:link | link
> isBroken]]).
>        self
>                shouldnt: [self command execute]
>                raise: PRStructureError.
>        self
>                assert: (self command root contents includesSubString: 'two
> children, *folder* and *folder/command*.').
>        self
>                assert: ((self command root childrenDecoration at: 'folder')
> contents includesSubString: 'has a *parent>../* and a
>  *sibling/child>command*.').
>        self
>                assert: (((self command root childrenDecoration at: 'folder')
> childrenDecoration at: 'command') contents includesSubString: 'Command has a
> *root parent>../..* and a  *sibling/parrent>..*.')
>
> Thanks,
> John
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki