def _reverse(self):
        for p in self.items:
            for h in p.hunks:
                h.startsrc, h.starttgt = h.starttgt, h.startsrc
                h.linessrc, h.linestgt = h.linestgt, h.linessrc
                for i, line in enumerate(h.text):
                    # need to use line[0:1] here, because line[0]
                    # returns int instead of bytes on Python 3
                    if line[0:1] == b'+':
                        h.text[i] = b'-' + line[1:]
                    elif line[0:1] == b'-':
                        h.text[i] = b'+' + line[1:]
reverse patch direction (this doesn't touch filenames)
dataset/ETHPy150Open ensime/ensime-sublime/patch.py/PatchSet._reverse