def setup(self): super(TestGitHelper, self).setup() self.GIT_OLD_DIR = os.path.join(self.WORKING_DIR, settings.OLD_SOURCES_DIR) self.GIT_NEW_DIR = os.path.join(self.WORKING_DIR, settings.NEW_SOURCES_DIR) self.old_git_path = os.path.join(self.GIT_OLD_DIR, 'project-1.0.0') self._extract_sources(self.OLD_SOURCES, self.GIT_OLD_DIR) self._extract_sources(self.NEW_SOURCES, self.GIT_NEW_DIR) self.git_helper = GitHelper(self.old_git_path) self._init_git_repo(self.old_git_path)
def patch_sources(self, sources): # Patch sources git_helper = GitHelper(sources[0]) if not self.conf.non_interactive: git_helper.check_git_config() patch = Patcher(GitHelper.GIT) self.rebase_spec_file.update_changelog( self.rebase_spec_file.get_new_log(git_helper)) try: self.rebased_patches = patch.patch( sources[0], sources[1], self.old_rest_sources, git_helper, self.spec_file.get_applied_patches(), self.spec_file.get_prep_section(), **self.kwargs) except RuntimeError: raise RebaseHelperError('Patching failed') self.rebase_spec_file.write_updated_patches(self.rebased_patches) results_store.set_patches_results(self.rebased_patches)
def init_git(cls, directory): """Function initialize old and new Git repository""" gh = GitHelper(directory) gh.command_init(directory) gh.command_add_files('.') gh.command_commit(message='Initial Commit')