Ticket #71: update-sourcestamps.patch

File update-sourcestamps.patch, 3.5 KB (added by dustin, 5 years ago)
  • buildbot/interfaces.py

    Patch to allow SourceStamps to be updated from an "original"
    SourceStamp (based on a set of Changes) to a "specific"
    SourceStamp (with an explicit revision).  Default functionality of
    BuildStatus.getSourceStamp() is not altered.
    old new  
    9898        BuildRequests. This is called by a Build when it starts, to figure 
    9999        out what its sourceStamp should be.""" 
    100100 
     101    def getUpdatedSourceStamp(self, got_revision): 
     102        """Get a new SourceStamp object reflecting the actual revision found 
     103        by a Source step.""" 
     104 
    101105    def getText(self): 
    102106        """Returns a list of strings to describe the stamp. These are 
    103107        intended to be displayed in a narrow column. If more space is 
     
    346350 
    347351    def getSourceStamp(): 
    348352        """Return a SourceStamp object which can be used to re-create 
    349         the source tree that this build used. 
     353        the source tree that this build used.  This method will 
     354        return the most specific information possible, and its results 
     355        may change as the build progresses.  Specifically, a "HEAD" 
     356        build may later be more accurately specified with the specific 
     357        revision information. 
    350358 
    351359        This method will return None if the source information is no longer 
    352360        available.""" 
  • buildbot/sourcestamp.py

    old new  
    8080                                changes=changes) 
    8181        return newsource 
    8282 
     83    def getUpdatedSourceStamp(self, got_revision): 
     84        return SourceStamp(branch=self.branch, revision=got_revision, patch=self.patch) 
     85 
    8386    def getText(self): 
    8487        # XXX this won't work for VC's with huge 'revision' strings 
    8588        if self.revision is None: return [ "latest" ] 
  • buildbot/status/builder.py

    old new  
    951951            return None 
    952952        return self.builder.getBuild(self.number-1) 
    953953 
    954     def getSourceStamp(self): 
    955         return self.source 
     954    def getSourceStamp(self, specific=False): 
     955        if not specific or not self.properties.has_key('got_revision'): 
     956            return self.source 
     957        return self.source.getUpdatedSourceStamp(self.properties['got_revision']) 
    956958 
    957959    def getReason(self): 
    958960        return self.reason 
  • buildbot/process/builder.py

    old new  
    672672            return 
    673673 
    674674        # get a source stamp, possibly more specific than the original 
    675         ss = bs.getSourceStamp() 
    676         changes = bs.getChanges() 
    677         ss = sourcestamp.SourceStamp(ss.branch, ss.revision, ss.patch, changes) 
     675        ss = bs.getSourceStamp(specific=True) 
    678676 
    679677        req = base.BuildRequest(reason, ss, self.original.name) 
    680678        self.requestBuild(req)