tools/bisect-builds.py
def GetRevList(self, archive):
    """Gets the list of revision numbers between self.good_revision and
    self.bad_revision."""

    cache = {}
    # The cache is stored in the same directory as bisect-builds.py
    cache_filename = os.path.join(
        os.path.abspath(os.path.dirname(__file__)),
        '.bisect-builds-cache.json')
    cache_dict_key = self.GetListingURL()

    def _LoadBucketFromCache():
      if self.use_local_cache:
        try:
          with open(cache_filename) as cache_file:
            for (key, value) in json.load(cache_file).items():
              cache[key] = value
            revisions = cache.get(cache_dict_key, [])
            githash_svn_dict = cache.get('githash_svn_dict', {})
            if revisions:
              print('Loaded revisions %d-%d from %s' %
                    (revisions[0], revisions[-1], cache_filename))
            return (revisions, githash_svn_dict)
        except (EnvironmentError, ValueError):
          pass
      return ([], {})

    def _SaveBucketToCache():
      """Save the list of revisions and the git-svn mappings to a file.
      The list of revisions is assumed to be sorted."""
      if self.use_local_cache:
        cache[cache_dict_key] = revlist_all
        cache['githash_svn_dict'] = self.githash_svn_dict
        try:
          with open(cache_filename, 'w') as cache_file:
            json.dump(cache, cache_file)
          print('Saved revisions %d-%d to %s' %
                (revlist_all[0], revlist_all[-1], cache_filename))
        except EnvironmentError:
          pass

    # Download the revlist and filter for just the range between good and bad.
    minrev = min(self.good_revision, self.bad_revision)
    maxrev = max(self.good_revision, self.bad_revision)

    (revlist_all, self.githash_svn_dict) = _LoadBucketFromCache()
    last_known_rev = revlist_all[-1] if revlist_all else 0
    if last_known_rev < maxrev:
      revlist_all.extend(map(int, self.ParseDirectoryIndex(last_known_rev)))
      revlist_all = list(set(revlist_all))
      revlist_all.sort()
      _SaveBucketToCache()

    revlist = [x for x in revlist_all if x >= int(minrev) and x <= int(maxrev)]
    if len(revlist) < 2:  # Don't have enough builds to bisect.
      last_known_rev = revlist_all[-1] if revlist_all else 0
      first_known_rev = revlist_all[0] if revlist_all else 0
      # Check for specifying a number before the available range.
      if maxrev < first_known_rev:
        msg = (
            'First available bisect revision for %s is %d. Be sure to specify revision '
            'numbers, not branch numbers.' % (archive, first_known_rev))
        raise (RuntimeError(msg))

      # Check for specifying a number beyond the available range.
      if maxrev > last_known_rev:
        # Check for the special case of linux where bisect builds stopped at
        # revision 382086, around March 2016.
        if archive == 'linux':
          msg = 'Last available bisect revision for %s is %d. Try linux64 instead.' % (
              archive, last_known_rev)
        else:
          msg = 'Last available bisect revision for %s is %d. Try a different good/bad range.' % (
              archive, last_known_rev)
        raise (RuntimeError(msg))

      # Otherwise give a generic message.
      msg = 'We don\'t have enough builds to bisect. revlist: %s' % revlist
      raise RuntimeError(msg)

    # Set good and bad revisions to be legit revisions.
    if revlist:
      if self.good_revision < self.bad_revision:
        self.good_revision = revlist[0]
        self.bad_revision = revlist[-1]
      else:
        self.bad_revision = revlist[0]
        self.good_revision = revlist[-1]

      # Fix chromium rev so that the deps blink revision matches REVISIONS file.
      if self.base_url == WEBKIT_BASE_URL:
        revlist_all.sort()
        self.good_revision = FixChromiumRevForBlink(revlist,
                                                    revlist_all,
                                                    self,
                                                    self.good_revision)
        self.bad_revision = FixChromiumRevForBlink(revlist,
                                                   revlist_all,
                                                   self,
                                                   self.bad_revision)
    return revlist
Gets the list of revision numbers between self.good_revision and
    self.bad_revision.
Gets the list of revision numbers between self.good_revision and
self.bad_revision.
Gets the list of revision numbers between self . good_revision and self . bad_revision .
def GetRevList(self, archive):
    cache = {}
    cache_filename = os.path.join(
        os.path.abspath(os.path.dirname(__file__)),
        '.bisect-builds-cache.json')
    cache_dict_key = self.GetListingURL()
    def _LoadBucketFromCache():
      if self.use_local_cache:
        try:
          with open(cache_filename) as cache_file:
            for (key, value) in json.load(cache_file).items():
              cache[key] = value
            revisions = cache.get(cache_dict_key, [])
            githash_svn_dict = cache.get('githash_svn_dict', {})
            if revisions:
              print('Loaded revisions %d-%d from %s' %
                    (revisions[0], revisions[-1], cache_filename))
            return (revisions, githash_svn_dict)
        except (EnvironmentError, ValueError):
          pass
      return ([], {})
    def _SaveBucketToCache():
      if self.use_local_cache:
        cache[cache_dict_key] = revlist_all
        cache['githash_svn_dict'] = self.githash_svn_dict
        try:
          with open(cache_filename, 'w') as cache_file:
            json.dump(cache, cache_file)
          print('Saved revisions %d-%d to %s' %
                (revlist_all[0], revlist_all[-1], cache_filename))
        except EnvironmentError:
          pass
    minrev = min(self.good_revision, self.bad_revision)
    maxrev = max(self.good_revision, self.bad_revision)
    (revlist_all, self.githash_svn_dict) = _LoadBucketFromCache()
    last_known_rev = revlist_all[-1] if revlist_all else 0
    if last_known_rev < maxrev:
      revlist_all.extend(map(int, self.ParseDirectoryIndex(last_known_rev)))
      revlist_all = list(set(revlist_all))
      revlist_all.sort()
      _SaveBucketToCache()
    revlist = [x for x in revlist_all if x >= int(minrev) and x <= int(maxrev)]
    if len(revlist) < 2:  
      last_known_rev = revlist_all[-1] if revlist_all else 0
      first_known_rev = revlist_all[0] if revlist_all else 0
      if maxrev < first_known_rev:
        msg = (
            'First available bisect revision for %s is %d. Be sure to specify revision '
            'numbers, not branch numbers.' % (archive, first_known_rev))
        raise (RuntimeError(msg))
      if maxrev > last_known_rev:
        if archive == 'linux':
          msg = 'Last available bisect revision for %s is %d. Try linux64 instead.' % (
              archive, last_known_rev)
        else:
          msg = 'Last available bisect revision for %s is %d. Try a different good/bad range.' % (
              archive, last_known_rev)
        raise (RuntimeError(msg))
      msg = 'We don\'t have enough builds to bisect. revlist: %s' % revlist
      raise RuntimeError(msg)
    if revlist:
      if self.good_revision < self.bad_revision:
        self.good_revision = revlist[0]
        self.bad_revision = revlist[-1]
      else:
        self.bad_revision = revlist[0]
        self.good_revision = revlist[-1]
      if self.base_url == WEBKIT_BASE_URL:
        revlist_all.sort()
        self.good_revision = FixChromiumRevForBlink(revlist,
                                                    revlist_all,
                                                    self,
                                                    self.good_revision)
        self.bad_revision = FixChromiumRevForBlink(revlist,
                                                   revlist_all,
                                                   self,
                                                   self.bad_revision)
    return revlist
def GetRevList ( self , archive ) : cache = { } cache_filename = os . path . join ( os . path . abspath ( os . path . dirname ( __file__ ) ) , '.bisect-builds-cache.json' ) cache_dict_key = self . GetListingURL ( ) def _LoadBucketFromCache ( ) : if self . use_local_cache : try : with open ( cache_filename ) as cache_file : for ( key , value ) in json . load ( cache_file ) . items ( ) : cache [ key ] = value revisions = cache . get ( cache_dict_key , [ ] ) githash_svn_dict = cache . get ( 'githash_svn_dict' , { } ) if revisions : print ( 'Loaded revisions %d-%d from %s' % ( revisions [ 0 ] , revisions [ - 1 ] , cache_filename ) ) return ( revisions , githash_svn_dict ) except ( EnvironmentError , ValueError ) : pass return ( [ ] , { } ) def _SaveBucketToCache ( ) : """Save the list of revisions and the git-svn mappings to a file.
      The list of revisions is assumed to be sorted.""" if self . use_local_cache : cache [ cache_dict_key ] = revlist_all cache [ 'githash_svn_dict' ] = self . githash_svn_dict try : with open ( cache_filename , 'w' ) as cache_file : json . dump ( cache , cache_file ) print ( 'Saved revisions %d-%d to %s' % ( revlist_all [ 0 ] , revlist_all [ - 1 ] , cache_filename ) ) except EnvironmentError : pass minrev = min ( self . good_revision , self . bad_revision ) maxrev = max ( self . good_revision , self . bad_revision ) ( revlist_all , self . githash_svn_dict ) = _LoadBucketFromCache ( ) last_known_rev = revlist_all [ - 1 ] if revlist_all else 0 if last_known_rev < maxrev : revlist_all . extend ( map ( int , self . ParseDirectoryIndex ( last_known_rev ) ) ) revlist_all = list ( set ( revlist_all ) ) revlist_all . sort ( ) _SaveBucketToCache ( ) revlist = [ x for x in revlist_all if x >= int ( minrev ) and x <= int ( maxrev ) ] if len ( revlist ) < 2 : last_known_rev = revlist_all [ - 1 ] if revlist_all else 0 first_known_rev = revlist_all [ 0 ] if revlist_all else 0 if maxrev < first_known_rev : msg = ( 'First available bisect revision for %s is %d. Be sure to specify revision ' 'numbers, not branch numbers.' % ( archive , first_known_rev ) ) raise ( RuntimeError ( msg ) ) if maxrev > last_known_rev : if archive == 'linux' : msg = 'Last available bisect revision for %s is %d. Try linux64 instead.' % ( archive , last_known_rev ) else : msg = 'Last available bisect revision for %s is %d. Try a different good/bad range.' % ( archive , last_known_rev ) raise ( RuntimeError ( msg ) ) msg = 'We don\'t have enough builds to bisect. revlist: %s' % revlist raise RuntimeError ( msg ) if revlist : if self . good_revision < self . bad_revision : self . good_revision = revlist [ 0 ] self . bad_revision = revlist [ - 1 ] else : self . bad_revision = revlist [ 0 ] self . good_revision = revlist [ - 1 ] if self . base_url == WEBKIT_BASE_URL : revlist_all . sort ( ) self . good_revision = FixChromiumRevForBlink ( revlist , revlist_all , self , self . good_revision ) self . bad_revision = FixChromiumRevForBlink ( revlist , revlist_all , self , self . bad_revision ) return revlist
Gets the list of revision numbers between self.good_revision and
self.bad_revision.
Gets the list of revision numbers between self . good_revision and self . bad_revision .
"""Gets the list of revision numbers between self.good_revision and
    self.bad_revision.""" # The cache is stored in the same directory as bisect-builds.py """Save the list of revisions and the git-svn mappings to a file.
      The list of revisions is assumed to be sorted.""" # Download the revlist and filter for just the range between good and bad. # Don't have enough builds to bisect. # Check for specifying a number before the available range. # Check for specifying a number beyond the available range. # Check for the special case of linux where bisect builds stopped at # revision 382086, around March 2016. # Otherwise give a generic message. # Set good and bad revisions to be legit revisions. # Fix chromium rev so that the deps blink revision matches REVISIONS file.
self
archive