Ticket #470: source.py.patch

File source.py.patch, 2.3 KB (added by ipv6guru, 4 years ago)
  • buildbot/steps/source.py

    RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/source.py,v
    retrieving revision 1.3
    diff -u -r1.3 source.py
     
    347347    name = 'svn' 
    348348 
    349349    def __init__(self, svnurl=None, baseURL=None, defaultBranch=None, 
    350                  directory=None, **kwargs): 
     350                 directory=None, svndir=None, **kwargs): 
    351351        """ 
    352352        @type  svnurl: string 
    353353        @param svnurl: the URL which points to the Subversion server, 
     
    368368                              explicitly. It will simply be appended 
    369369                              to C{baseURL} and the result handed to 
    370370                              the SVN command. 
     371 
     372        @param svndir: if branches are enabled, this is the directory 
     373                       to append to the URL after C{baseURL} and the branch 
     374                       have been appended.  You can use this to check out a 
     375                       subdirectory of the repository.  It should start with 
     376                       a slash.                               
    371377        """ 
    372378 
    373379        if not kwargs.has_key('workdir') and directory is not None: 
     
    379385        self.svnurl = svnurl 
    380386        self.baseURL = baseURL 
    381387        self.branch = defaultBranch 
     388        self.svndir = svndir 
    382389 
    383390        Source.__init__(self, **kwargs) 
    384391 
     
    448455            self.args['svnurl'] = self.svnurl 
    449456        else: 
    450457            self.args['svnurl'] = self.baseURL + branch 
     458            if self.svndir is not None: 
     459                self.args['svnurl'] = self.args['svnurl'] + self.svndir 
     460 
     461        # add peg-revision to svnurl 
     462        if revision is not None and revision != "HEAD": 
     463            self.args['svnurl'] = self.args['svnurl'] + "@" + str(revision) 
     464             
    451465        self.args['revision'] = revision 
    452466        self.args['patch'] = patch 
    453467 
    454468        revstuff = [] 
    455469        if branch is not None and branch != self.branch: 
    456             revstuff.append("[branch]") 
     470            revstuff.append("[%s]" % branch) 
    457471        if revision is not None: 
    458472            revstuff.append("r%s" % revision) 
    459473        self.description.extend(revstuff)