You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Matthew J Fletcher <am...@sky.com> on 2012/03/24 12:34:07 UTC

Recursive externals checkout

Hi,

As discussed in this thread,..

http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2939615

Do you think svn checkout should be defensive against recursive externals ?


regards

---
Matthew J Fletcher

RE: Recursive externals checkout

Posted by Dominik Psenner <dp...@gmail.com>.
>> The problem may be levered by recursively comparing the repository UID
>and
>> the relative path in the uri when the external is resolved. Proofing that
>> this check would be enough is left to the reader. :-)
>
>This will catch the "simple" case when an external includes its own parent
>directory.
>
>But it will not catch mutually recursive externals (svn://path/to/a/
>includes svn://path/to/b/ and vice-versa), there might even exist cycles
>over 3 or more repositories...

That's what I ment with recursive. Since externals resolve from the parent
repository down to the child repository, before checking out the child
repository all parent repositories would have to be checked if it could be a
recursive checkout, i.e. in a python-like pseudocode:

Def Checkout(repoUri, []parents={}):
  Foreach childRepoUri in repoUri:
     If(IsPossiblyRecursive(childRepoUri, parents)):
        Warn()
        If(ConfirmByUser())
           Checkout(childRepoUri, parents.Append(childRepoUri))
     Else
        Checkout(childRepoUri, parents.Append(childRepoUri))

Def IsPossiblyRecursive (repoUri, []parents={}):
   If(parents.Count > 0)
      Foreach parent in parents:
         If(IsPossiblyRecursive (repoUri, parent))
            True
   Else
      False

Def IsPossiblyRecursive (repoUri, parent):
   If(UID(repoUri) == UID(parent))
       # this might be a recursive checkout
       # other checks like comparing the relative path could be put here
       True
   False

Cheers,
Dominik


AW: Recursive externals checkout

Posted by Markus Schaber <m....@3s-software.com>.
Hi, Dominik,

Von: Dominik Psenner [mailto:dpsenner@gmail.com]
> >http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2939615
> >>
> >> Do you think svn checkout should be defensive against recursive externals?
> >
> >At elego (where I work) we actually use this as a trick question during
> >Subversion workshops. People who don't necessarily know about externals
> >are asked to check out a working copy (which, unknown to them, contains
> >recursive externals) and are asked to figure out if anything is going
> >wrong and if so how to fix it. Once they've figured out and fixed the
> >problem they understand what externals are :)
> >
> >That aside, I wouldn't mind if svn printed a warning or error message
> >when it finds a recursive externals definition. But off-hand I don't
> >what a good method for detecting recursion would be.
> >It's somewhat complicated by the fact that externals are currently
> >separate working copies and that the recursion might be rooted not only
> >at the immediate parent WC but at some parent of the parent.
> >Cross-working-copy operations aren't trivial to implement correctly.
> 
> The problem may be levered by recursively comparing the repository UID and
> the relative path in the uri when the external is resolved. Proofing that
> this check would be enough is left to the reader. :-)

This will catch the "simple" case when an external includes its own parent directory.

But it will not catch mutually recursive externals (svn://path/to/a/ includes svn://path/to/b/ and vice-versa), there might even exist cycles over 3 or more repositories...


Best regards

Markus Schaber
-- 
___________________________
We software Automation.

3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50

Email: m.schaber@3s-software.com | Web: http://www.3s-software.com 
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 


RE: Recursive externals checkout

Posted by Dominik Psenner <dp...@gmail.com>.
>http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=
>2939615
>>
>> Do you think svn checkout should be defensive against recursive externals
>?
>
>At elego (where I work) we actually use this as a trick question during
>Subversion workshops. People who don't necessarily know about externals
>are asked to check out a working copy (which, unknown to them, contains
>recursive externals) and are asked to figure out if anything is going
>wrong and if so how to fix it. Once they've figured out and fixed the
>problem they understand what externals are :)
>
>That aside, I wouldn't mind if svn printed a warning or error message
>when it finds a recursive externals definition. But off-hand I don't
>what a good method for detecting recursion would be.
>It's somewhat complicated by the fact that externals are currently
>separate working copies and that the recursion might be rooted not
>only at the immediate parent WC but at some parent of the parent.
>Cross-working-copy operations aren't trivial to implement correctly.

The problem may be levered by recursively comparing the repository UID and
the relative path in the uri when the external is resolved. Proofing that
this check would be enough is left to the reader. :-)

JMTC


Re: Recursive externals checkout

Posted by Stefan Sperling <st...@elego.de>.
On Sat, Mar 24, 2012 at 11:34:07AM +0000, Matthew J Fletcher wrote:
> Hi,
> 
> As discussed in this thread,..
> 
> http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2939615
> 
> Do you think svn checkout should be defensive against recursive externals ?

At elego (where I work) we actually use this as a trick question during
Subversion workshops. People who don't necessarily know about externals
are asked to check out a working copy (which, unknown to them, contains
recursive externals) and are asked to figure out if anything is going
wrong and if so how to fix it. Once they've figured out and fixed the
problem they understand what externals are :)

That aside, I wouldn't mind if svn printed a warning or error message
when it finds a recursive externals definition. But off-hand I don't
what a good method for detecting recursion would be.
It's somewhat complicated by the fact that externals are currently
separate working copies and that the recursion might be rooted not
only at the immediate parent WC but at some parent of the parent.
Cross-working-copy operations aren't trivial to implement correctly.