def set_current_directory(self, directory, reset_all=False): """ Sets the current directory. :param directory: The git directory. """ self._models = {} a_model = QGitModel(directory) self.current_branch = a_model.get_current_branch() for branch in a_model.get_branches(): model = QEditableGitModel(self._models, directory=directory, parent=self) model.set_current_branch(branch) model.setMerge(False) model.enable_option("filters") model.populate() self._models[branch] = model QObject.connect(model, SIGNAL("newHistoryEvent"), self.new_history_event) if reset_all: self.rebase_main_class.reset_interface(self._models) self.filter_main_class.reset_interface(self._models)
def apply_finished(self, write_results): """ This method is called when the progress thread is finished. """ self._applying = False self._ui.applyButton.setEnabled(True) a_repo = Repo(self._directory) for model, success in write_results.items(): if success and model.is_fake_model(): # If the applied models were fake, rebuild them. branch_name = model.name_to_display() new_branch = [branch for branch in a_repo.branches if branch.name == branch_name][0] new_model = QEditableGitModel(self._models, directory=self._directory, parent=self) new_model.set_current_branch(new_branch) new_model.populate() self.remove_model(model) self.add_new_model(new_model) elif not success: if model.write_errors(): for error in model.write_errors(): print error else: model.reset() conflicting_index = model.get_conflicting_index() self.rebase_main_class.commit_clicked(conflicting_index) elif success: model.populate() if True in write_results.values(): # Reset history self.reset_history()