def same_diffs(commit1, commit2):
    """Whether those 2 commits have the same change

    Run "git range-diff" against 2 commit ranges:
        1. parent of commit1 to commit1
        1. parent of commit2 to commit2

    If the two produce the same diff then git will only show header lines
        Header lines are prefixed like "1: ...."
    Otherwise there will be lines after the header lines
        (and those lines will show the difference)
    """
    def range_one(commit):
        """A git commit "range" to include only one commit"""
        return '%s^..%s' % (commit, commit)

    output = run('range-diff %s %s' % (range_one(commit1), range_one(commit2)))
    lines = output.splitlines()
    for i, line in enumerate(lines, 1):
        if not line.startswith('%s: ' % i):
            break
    return not lines[i:]
Whether those 2 commits have the same change

    Run "git range-diff" against 2 commit ranges:
        1. parent of commit1 to commit1
        1. parent of commit2 to commit2

    If the two produce the same diff then git will only show header lines
        Header lines are prefixed like "1: ...."
    Otherwise there will be lines after the header lines
        (and those lines will show the difference)