def discard_last_commit(self): if ( QMessageBox.warning( self, "Discard last commit?", "this will do a hard reset to the previous commit, so the current one will be lost", QMessageBox.Yes, QMessageBox.No, ) == QMessageBox.Yes ): rollback()
def rollback(self): targetCommit = self.commits.currentItem().text().split(' ')[0] if QMessageBox.warning(None, 'Rollback to commit?', 'All commits after ' + targetCommit + ' will be lost, proceed?', QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes: rollback(targetCommit)