Esempio n. 1
0
File: mod.py Progetto: epowers/arc
  def rebase(self, old_revision, force_new_mod_path=None):
    if not self._verified:
      self.verify(old_revision, force_new_mod_path)

    if self._status is not None:
      return

    # Move the mod to the new location if different from the old location
    internal.move_mod_file(self._mod_path, self._new_mod_path)

    with internal.old_file_content(
        old_revision, self._android_path,
        self._android_module_path) as tmp_android_path:
      # Attempt an automatic three-way merge using the mod, the old source code
      # and the new source code.
      if not internal.merge3(
          self._new_mod_path, tmp_android_path, self._new_android_path):
        self._status = constants.RESULT_NO_CLEAN_MERGE
        return

    if not internal.validate_android_mod(
        self._new_mod_path, self._new_android_path):
      self._status = constants.RESULT_NO_CLEAN_MERGE
      return

    git.add_to_staging(self._new_mod_path, cwd=self._arc_git_root)
    self._status = constants.RESULT_OK
Esempio n. 2
0
    def rebase(self, old_revision, force_new_mod_path=None):
        if not self._verified:
            self.verify(old_revision, force_new_mod_path)

        if self._status is not None:
            return

        # Move the mod to the new location if different from the old location
        internal.move_mod_file(self._mod_path, self._new_mod_path)

        with internal.old_file_content(
                old_revision, self._android_path,
                self._android_module_path) as tmp_android_path:
            # Attempt an automatic three-way merge using the mod, the old source code
            # and the new source code.
            if not internal.merge3(self._new_mod_path, tmp_android_path,
                                   self._new_android_path):
                self._status = constants.RESULT_NO_CLEAN_MERGE
                return

        if not internal.validate_android_mod(self._new_mod_path,
                                             self._new_android_path):
            self._status = constants.RESULT_NO_CLEAN_MERGE
            return

        git.add_to_staging(self._new_mod_path, cwd=self._arc_git_root)
        self._status = constants.RESULT_OK
Esempio n. 3
0
def _update_subproject(deps,
                       state,
                       subproject,
                       module_path,
                       verify_only=False):
    desired_revision = deps.get_revision_for(subproject)
    if desired_revision is None:
        logging.warning('Skipping unknown subproject %s', subproject)
        return

    logging.info('%s Fetching information about %s', subproject,
                 desired_revision)

    # Convert the desired revision into a hash (if not already one).
    desired_revision = git.get_ref_hash(desired_revision, cwd=module_path)

    # Get the current version of the repo. We will need this to rebase the mods
    # after we roll forward.
    current_revision = git.get_head_revision(cwd=module_path)

    if desired_revision == current_revision:
        logging.info('%s is already at %s', subproject, desired_revision)

        # If we are doing an update, we can stop now, and assume that no work needs
        # to be done to the mods for that submodule.
        if not verify_only:
            return

    if not state.verify_submodule_path(current_revision, module_path):
        return

    # If we are only verifying, stop here before making any actual changes.
    if verify_only:
        return

    logging.info('%s checking out %s', subproject, desired_revision)
    git.force_checkout_revision(desired_revision, cwd=module_path)
    git.add_to_staging(module_path)

    logging.info('%s rebasing mods', subproject)
    state.rebase_submodule_path(current_revision, module_path)
Esempio n. 4
0
def _update_subproject(deps, state, subproject, module_path, verify_only=False):
  desired_revision = deps.get_revision_for(subproject)
  if desired_revision is None:
    logging.warning('Skipping unknown subproject %s', subproject)
    return

  logging.info('%s Fetching information about %s', subproject, desired_revision)

  # Convert the desired revision into a hash (if not already one).
  desired_revision = git.get_ref_hash(desired_revision, cwd=module_path)

  # Get the current version of the repo. We will need this to rebase the mods
  # after we roll forward.
  current_revision = git.get_head_revision(cwd=module_path)

  if desired_revision == current_revision:
    logging.info('%s is already at %s', subproject, desired_revision)

    # If we are doing an update, we can stop now, and assume that no work needs
    # to be done to the mods for that submodule.
    if not verify_only:
      return

  if not state.verify_submodule_path(current_revision, module_path):
    return

  # If we are only verifying, stop here before making any actual changes.
  if verify_only:
    return

  logging.info('%s checking out %s', subproject, desired_revision)
  git.force_checkout_revision(desired_revision, cwd=module_path)
  git.add_to_staging(module_path)

  logging.info('%s rebasing mods', subproject)
  state.rebase_submodule_path(current_revision, module_path)