<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def revert(self, unchanged_only=False):
 """Revert all files in this changelist :param unchanged_only: Only revert unchanged files :type unchanged_only: bool :raises: :class:`.ChangelistError` """

        if self._reverted:
            raise errors.ChangelistError('This changelist has been reverted')

        change = self._change
        if self._change == 0:
            change = 'default'

        cmd = ['revert', '-c', str(change)]

        if unchanged_only:
            cmd.append('-a')

        files = [f.depotFile for f in self._files]
        if files:
            cmd += files
            self._connection.run(cmd)

        self._files = []
        self._reverted = True