code: def sort(self):
          self.sorted_commits = []
          if not self.commits:
              return self.sorted_commits
          prev_commit = self.commits.pop(0)
          prev_line = prev_commit.line_number
          prev_uuid = prev_commit.uuid
          for commit in self.commits:
              if (commit.uuid != prev_uuid or
                      commit.line_number != (prev_line + 1)):
                  prev_commit.lines = self.line_range(prev_commit.line_number,
                                                      prev_line)
                  self.sorted_commits.append(prev_commit)
                  prev_commit = commit
              prev_line = commit.line_number
              prev_uuid = commit.uuid
          prev_commit.lines = self.line_range(prev_commit.line_number, prev_line)
          self.sorted_commits.append(prev_commit)
          return self.sorted_commits