Get the list of files changed with the type of change for a given revision.
Results are returned as a structured array.

@param String $rev A valid changeset for this repo
@return array List of file changes
68
public function getChangedFiles($rev)
    {
        $raw_changes = $this->execute('hg status --change ' . $rev);
        $this->repository_type = 'hg';

        $changes = [];
        foreach ($raw_changes as $key => $change) {
            $exploded_change = explode(' ', $change);
            $changes[$key]['type'] = $exploded_change[0];
            $changes[$key]['path'] = $exploded_change[1];
        }

        return $changes;
    }
255078
protected function getDeltasFilesArray()
    {
        $files = [];

        $baseDir = realpath($this->dir);
        $dh = opendir($baseDir);

        if ($dh === false) {
            return $files;
        }

        $fileChangeNumberPrefix = '';
        while (($file = readdir($dh)) !== false) {
            if (preg_match('[\d+]', $file, $fileChangeNumberPrefix)) {
                $files[(int) $fileChangeNumberPrefix[0]] = $file;
            }
        }

        return $files;
    }
440515
@XmlElementWrapper(name="revisions")
    @XmlElement(name="rev", type=Rev.class)
    public List<Rev> getRevisions() {
        return revisions;
    }
858692
private function getTokenForRevision( Revision $revision ) {
		$result = $this->api->postRequest(
			new SimpleRequest(
				'query', [
				'prop' => 'revisions',
				'revids' => $revision->getId(),
				'rvtoken' => 'rollback',
			]
			)
		);
		$result = array_shift( $result['query']['pages'] );

		return $result['revisions'][0]['rollbacktoken'];
	}
355682
public function getList($flip = false)
    {
        if ($flip !== false) {
            return array_flip($this->mime);
        } else {
            return $this->mime;
        }
    }
116643
public function getCollectionByContentAction($type, $uid, $start, $count)
    {
        $content = $this->findOneByTypeAndUid($type, $uid);
        $this->granted('VIEW', $content);

        $revisions = $this->getEntityManager()
                ->getRepository('BackBee\ClassContent\Revision')
                ->getRevisions($content, [Revision::STATE_COMMITTED], $start, $count);

        $result = [];
        foreach ($revisions as $revision) {
            $result[] = $revision->jsonSerialize(Revision::JSON_REVISION_FORMAT);
        }

        $response = $this->createJsonResponse();
        $response->setData($result);

        if ($revisions instanceof Paginator) {
            $response->headers->set('Content-Range', sprintf('%d-%d/%d', $start, $start +
                            count($result) - 1, count($revisions)));
        }

        return $response;
    }
995960
public function changelog($revision1, $revision2)
    {
        $this->fetch();

        return $this->execute('log', array(
                '--pretty=' => self::PRETTY_FORMAT,
                sprintf('%s^1..%s', $revision1, $revision2),
            )
        );
    }
533137
public function getDiffFile($file)
    {
        $args = [
            '-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision,
            '--', $this->repository->getWikiDir().$file,
        ];

        $diff = Diff::parse($this->repository->run('diff-tree', $args));
        $diff->setRepository($this->repository);

        return $diff;
    }
991780
private function rollbackToRevision(Revision $revision) {
        if ($revision == null) {
            return null;
        }

        $current = $revision->revisioned;

        // delete the old revisions for this model if needed
        if($this->getConfigRollbackCleanup()) {
            $revisionsToDelete = $current->revisions()->where('id', '>=', $revision->id)->delete();
        }

        $current->fill($revision->old);
        $current->save();

        // reload the relations
        $current = $current->load('revisions');

        return $current;
    }
292271
public static function make($revision, $revisioned)
    {
        if (is_array($revision)) {
            return static::makeArray($revision, $revisioned);
        }

        if ($revision instanceof Collection) {
            return static::makeCollection($revision, $revisioned);
        }

        if (!$revision || $revision instanceof Model) {
            return static::makeOne($revision, $revisioned);
        }

        throw new \InvalidArgumentException(
            'Presenter::make accepts array, collection or single resource, '.gettype($revision).' given.'
        );
    }
1020259
public function getSize($revision = null)
	{
		// Without revision, use current info
		if (!isset($revision)) {
			return (int)$this->info['size'];
		}

		// Obtain the properties of the revision
		if (($info = $this->getRevision($revision)) === null) {
			return -1;
		}

		return (int)$info['size'];
	}
322601
private function getParamsFromRevision( Revision $revision ) {
		$params = [
			'undo' => $revision->getId(),
			'token' => $this->api->getToken(),
		];

		if ( !is_null( $revision->getPageIdentifier()->getId() ) ) {
			$params['pageid'] = $revision->getPageIdentifier()->getId();
		} else {
			$params['title'] = $revision->getPageIdentifier()->getTitle()->getTitle();
		}

		return $params;
	}
699251
private function getMessage($revision)
    {
        switch ($revision->key) {
            case 'created_at':
                return $this->getResponsibleInfo($revision) . ' created user '
                    . $this->getAffectedResourceName($revision) . ' (' . $revision->revisionable_id . ')';
            case 'deleted_at':
                return $this->getResponsibleInfo($revision) . ' deleted user '
                    . $this->getAffectedResourceName($revision) . ' (' . $revision->revisionable_id . ')';
            default:
                return $this->getResponsibleInfo($revision) . ' changed user '
                    . $this->getAffectedResourceName($revision) . ' (' . $revision->revisionable_id . ')'
                    . ' field ' .  $revision->fieldName() . ' from ' .$revision->oldValue() . ' to ' .
                    $revision->newValue();
        }
    }
924746
public function getChangedFiles(string $from, string $to): array
    {
        $cmd    = (new ChangedFiles($this->repo->getRoot()))->fromRevision($from)->toRevision($to);
        $result = $this->runner->run($cmd);

        return $result->getBufferedOutput();
    }
613996
private function getRevisionsFromResult( $array ) {
		$revisions = new Revisions();
		$pageid = $array['pageid'];
		foreach ( $array['revisions'] as $revision ) {
			$revisions->addRevision(
				new Revision(
					$this->getContent( $array['contentmodel'], $revision['*'] ),
					new PageIdentifier( new Title( $array['title'], $array['ns'] ), $pageid ),
					$revision['revid'],
					new EditInfo(
						$revision['comment'],
						array_key_exists( 'minor', $revision ),
						array_key_exists( 'bot', $revision )
					),
					$revision['user'],
					$revision['timestamp']
				)
			);
		}

		return $revisions;
	}
714111
public static function getRevision($length = 10)
    {
        $revision = Cache::call("revision", function() {
            $path = static::path(".git");
            if (!is_dir($path)) {
                return;
            }

            $head = $path . "/HEAD";
            if (!file_exists($head)) {
                return;
            }

            $data = File::getContents($head);
            if (!preg_match("/ref: ([^\s]+)\s/", $data, $matches)) {
                return;
            }
            $ref = $path . "/" . $matches[1];
            if (!file_exists($ref)) {
                return;
            }

            return File::getContents($ref);
        });

        if ($length > 0) {
            return substr($revision, 0, $length);
        } else {
            return $revision;
        }
    }
274461
protected function getChangeVersion(array $changes)
	{
		$version = $this->argument('version');

		if (is_null($version))
		{
			$latest = head(array_keys($changes));

			return array($latest, $changes[$latest]);
		}
		else
		{
			return array($version, array_get($changes, $version, array()));
		}
	}