def discard_files(self, repo, files):
        # See if any of the files cannot be discarded
        error = "You can't discard staged changes to the following files. Please unstage them first:\n\n  {errfiles}"
        errlist = []
        for s, f in files:
            if s == STAGED_CHANGES and not self.is_up_to_date(repo, f):
                errlist.append(f)

        if errlist:
            errfiles = "\n  ".join(errlist)
            sublime.error_message(error.format(errfiles=errfiles))
            return

        # Confirm before unstaging any files
        confirm = "Are you sure you want to perform the following actions?\n\n  {actions}"
        actionlist = []
        for s, f in files:
            staged = s == STAGED_CHANGES
            status = self.get_staging_status(repo, f) if staged else self.get_worktree_status(repo, f)

            if staged and f in errlist:
                continue

            if s != UNTRACKED_FILES or status == 'N':
                action = 'Delete: '
            elif status == 'D':
                action = 'Resurrect: '
            else:
                action = 'Discard: '

            actionlist.append("{action} {file}".format(action=action, file=f))

        if not actionlist:
            return

        actions = "\n  ".join(actionlist)
        if not sublime.ok_cancel_dialog(confirm.format(actions=actions), 'Continue'):
            return

        # perform various unstaging/deleting/resurrection actions
        for s, f in files:
            staged = s == STAGED_CHANGES
            status = self.get_staging_status(repo, f) if staged else self.get_worktree_status(repo, f)

            if staged and not self.is_up_to_date(repo, f):
                continue

            if s == UNTRACKED_FILES:
                self.git(['clean', '-d', '--force', '--', f], cwd=repo)
            elif status == 'D':
                self.git(['reset', '-q', '--', f], cwd=repo)
                self.git(['checkout', '--', f], cwd=repo)
            elif status == 'N':
                self.git(['rm', '-f', '--', f], cwd=repo)
            else:
                if staged:
                    self.git(['checkout', 'HEAD', '--', f], cwd=repo)
                else:
                    self.git(['checkout', '--', f], cwd=repo)

    # status helpers
dataset/ETHPy150Open SublimeGit/SublimeGit/sgit/status.py/GitStatusDiscardCommand.discard_files/operator `==` -> `!=`