Ejemplo n.º 1
0
        def update_availability_graph(file_system, channel_info):
            version_filename = assert_not_none(
                self._GetApiSchemaFilename(api_name, file_system,
                                           channel_info.version))
            version_stat = assert_not_none(file_system.Stat(version_filename))

            # Important optimisation: only re-parse the graph if the file changed in
            # the last revision. Parsing the same schema and forming a graph on every
            # iteration is really expensive.
            if version_stat == previous.stat:
                version_graph = previous.graph
            else:
                # Keep track of any new schema elements from this version by adding
                # them to |availability_graph|.
                #
                # Calling |availability_graph|.Lookup() on the nodes being updated
                # will return the |annotation| object -- the current |channel_info|.
                version_graph = APISchemaGraph(
                    self._GetApiSchema(api_name, file_system,
                                       channel_info.version))
                availability_graph.Update(
                    version_graph.Subtract(availability_graph),
                    annotation=channel_info)

            previous.stat = version_stat
            previous.graph = version_graph

            # Continue looping until there are no longer differences between this
            # version and trunk.
            return version_stat != trunk_stat
Ejemplo n.º 2
0
        def update_availability_graph(file_system, channel_info):
            version_graph = APISchemaGraph(get_schema(api_name, file_system))
            # Keep track of any new schema elements from this version by adding
            # them to |availability_graph|.
            #
            # Calling |availability_graph|.Lookup() on the nodes being updated
            # will return the |annotation| object.
            availability_graph.Update(
                version_graph.Subtract(availability_graph),
                annotation=channel_info)

            # Continue looping until there are no longer differences between this
            # version and trunk.
            return trunk_graph != version_graph
Ejemplo n.º 3
0
    def update_availability_graph(file_system, channel_info):
      # If we can't find a filename, skip checking at this branch.
      # For example, something could have a predetermined availability of 23,
      # but it doesn't show up in the file system until 26.
      # We know that the file will become available at some point.
      #
      # The problem with this is that at the first version where the API file
      # exists, we'll get a huge chunk of new objects that don't match
      # the predetermined API availability.
      version_filename = _GetAPISchemaFilename(api_name,
                                               file_system,
                                               channel_info.version)
      if version_filename is None:
        # Continue the loop at the next version.
        return True

      version_stat = assert_not_none(file_system.Stat(version_filename))

      # Important optimisation: only re-parse the graph if the file changed in
      # the last revision. Parsing the same schema and forming a graph on every
      # iteration is really expensive.
      if version_stat == previous.stat:
        version_graph = previous.graph
      else:
        # Keep track of any new schema elements from this version by adding
        # them to |availability_graph|.
        #
        # Calling |availability_graph|.Lookup() on the nodes being updated
        # will return the |annotation| object -- the current |channel_info|.
        version_graph = APISchemaGraph(
            api_schema=self._GetAPISchema(api_name,
                                          file_system,
                                          channel_info.version))
        def annotator(node_name):
          return self._CheckAPINodeAvailability('%s.%s' % (api_name, node_name),
                                                channel_info)

        availability_graph.Update(version_graph.Subtract(availability_graph),
                                  annotator)

      previous.stat = version_stat
      previous.graph = version_graph

      # Continue looping until there are no longer differences between this
      # version and master.
      return version_stat != master_stat