

def run(self, edit, discard='item'):
    repo = self.get_repo()
    if (not repo):
        return
    goto = None
    if (discard == 'section'):
        points = self.get_all_points()
        sections = set([self.section_at_point(p) for p in points])
        all_files = self.get_all_files()
        if (STASHES in sections):
            self.discard_all_stashes(repo)
        if (UNTRACKED_FILES in sections):
            self.discard_all_untracked(repo)
        files = [i for i in all_files if (i[0] in (UNSTAGED_CHANGES, STAGED_CHANGES))]
        if files:
            self.discard_files(repo, files)
    elif (discard == 'item'):
        files = self.get_selected_files()
        stashes = self.get_selected_stashes()
        if files:
            self.discard_files(repo, files)
        if stashes:
            self.discard_stashes(repo, stashes)
        goto = self.logical_goto_next_file()
    elif (discard == 'all'):
        self.discard_all(repo)
    self.update_status(goto)

dataset/ETHPy150Open SublimeGit/SublimeGit/sgit/status.py GitStatusDiscardCommand.run/original