def create_patch(self, selected_hunks):
        patch = []
        for (hstart, hend), hunks in selected_hunks.items():
            header = sublime.Region(hstart, hend)
            for head in self.view.lines(header):
                headline = self.view.substr(head)
                if headline.startswith('---') or headline.startswith('+++'):
                    patch.append("%s\n" % headline.strip())
                else:
                    patch.append("%s\n" % headline)
            for h in hunks:
                patch.append(self.view.substr(self.view.full_line(h)))
        return "".join(patch)
dataset/ETHPy150Open SublimeGit/SublimeGit/sgit/diff.py/GitDiffTextCmd.create_patch/original