[users at bb.net] Background on split_file_branches

Paulo Matos pmatos at linki.tools
Wed Sep 13 13:12:18 UTC 2017


Hello,

I am noticing a strange behaviour when using util.svn.split_file_branches.

It the branch is trunk, then it is set to None, i.e. if the function
receives 'trunk/foo.txt' it returns (None, 'foo.txt')

This is strange since, you use as suggested by the documentation:

SVN(repourl=Interpolate('svn://domain/%(src::branch)s'),
    ...)

this will checkout for trunk svn://domain//, and not svn://domain/trunk.
However it will work well for svn://domain/branches/1_4_1, etc.

This behaviour is rather confusing given the documentation where
src::branch is mentioned, which says you can use it as above.

On the other hand, I can define my own split file as:
def split_file_branches_with_trunk(path):
    pieces = path.split('/')
    if len(pieces) > 1 and pieces[0] == 'trunk':
        return (pieces[0], '/'.join(pieces[1:]))
    elif len(pieces) > 2 and pieces[0] == 'branches':
        return ('/'.join(pieces[0:2]), '/'.join(pieces[2:]))
    return None

And this will work... when I call the function I get as expected 'trunk'
as the first element of the tuple when relative path belongs to trunk.

However, when I use it in my class which inherits from, I cannot seem to
have access to these properties:

class CloneOrUpdateRepo (SVN):
    name = "update repo"
    description = r"fetching sources"
    descriptionDone = r"fetched sources"
    def __init__ (self):
        SVN.__init__ (self,
                      repourl =
util.Interpolate('svn://domain/svn/%(src::branch)s/'),
                      workdir =
util.Interpolate("%(prop:builddir)s/branch-%(src::branch)s/"),
                      mode = 'incremental')
        self.haltOnFailure = True

I expected these (src::branch) and (prop:builddir) to be stored globally
and that Interpolate would be able to access them everywhere but I seem
to be mistaken given that the above doesn't work.

What do I need so that my class gets access to the properties?

Thanks,

-- 
Paulo Matos


More information about the users mailing list