def MergeComponents(components):
  """Given a list of components, merges components with the same hierarchy.

  For components with same hierarchy, return the most fine-grained component.
  For example, if components are ['Blink', 'Blink>Editing'], we should only
  return ['Blink>Editing'].
  """
  if not components or len(components) == 1:
    return components

  components.sort()
  merged_components = []
  index = 1
  while index < len(components):
    if not components[index].startswith(components[index - 1] + '>'):
      merged_components.append(components[index - 1])

    index += 1

  merged_components.append(components[-1])
  return merged_components