Shows entities changed in the specified revision.

@param integer $rev
199972
public function revisionAction()
    {
        $revisionId = (int)$this->getEvent()->getRouteMatch()->getParam('revisionId');

        $revision = \SoliantEntityAudit\Module::getModuleOptions()->getEntityManager()
            ->getRepository('SoliantEntityAudit\\Entity\\Revision')
            ->find($revisionId);

        if (!$revision)
            return $this->plugin('redirect')->toRoute('audit');

        return array(
            'revision' => $revision,
        );
    }
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;
	}
1094135
public function deleteFromRevision( Revision $revision, array $extraParams = [] ) {
		$this->api->postRequest( new SimpleRequest(
			'delete',
			$this->getDeleteParams( $revision->getPageIdentifier(), $extraParams )
		) );
		return true;
	}
458630
private function checkContent(Revision $revision)
    {
        $content = $revision->getContent();

        if (null === $content || !($content instanceof AbstractClassContent)) {
            $this->_em->remove($revision);
            throw new ClassContentException('Orphan revision, deleted', ClassContentException::REVISION_ORPHAN);
        }

        if ($revision->getRevision() != $content->getRevision()) {
            throw new ClassContentException('Content is out of date', ClassContentException::REVISION_OUTOFDATE);
        }

        return $content;
    }
545561
public function getDescriptionUrl($revision = null)
	{
		// Without revision, use current info
		if (!isset($revision)) {
			return $this->info['descriptionurl'];
		}

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

		return $info['descriptionurl'];
	}
373044
public function rollback( Revision $revision, Title $title = null ) {
		$this->api->postRequest(
			new SimpleRequest( 'rollback', $this->getRollbackParams( $revision, $title ) )
		);

		return true;
	}
45158
def on_show(request, page_name):
    """"""
    revision_id = request.args.get("rev", type=int)
    query = RevisionedPage.query.filter_by(name=page_name)
    if revision_id:
        query = query.filter_by(revision_id=revision_id)
        revision_requested = True
    else:
        query = query.order_by(RevisionedPage.revision_id.desc())
        revision_requested = False
    page = query.first()
    if page is None:
        return page_missing(request, page_name, revision_requested)
    return Response(generate_template("action_show.html", page=page))
1216300
public function revisions($file, $limit = 10)
    {
        $call = 'revisions/' . $this->root . '/' . $this->encodePath($file);
        $params = array(
            'rev_limit' => ($limit < 1) ? 1 : (($limit > 1000) ? 1000 : (int) $limit),
        );
        $response = $this->fetch('GET', self::API_URL, $call, $params);
        return $response;
    }
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'];
	}
161564
def on_revert(request, page_name):
    """"""
    rev_id = request.args.get("rev", type=int)

    old_revision = page = None
    error = "No such revision"

    if request.method == "POST" and request.form.get("cancel"):
        return redirect(href(page_name))

    if rev_id:
        old_revision = Revision.query.filter(
            (Revision.revision_id == rev_id)
            & (Revision.page_id == Page.page_id)
            & (Page.name == page_name)
        ).first()
        if old_revision:
            new_revision = (
                Revision.query.filter(
                    (Revision.page_id == Page.page_id) & (Page.name == page_name)
                )
                .order_by(Revision.revision_id.desc())
                .first()
            )
            if old_revision == new_revision:
                error = "You tried to revert the current active revision."
            elif old_revision.text == new_revision.text:
                error = (
                    "There are no changes between the current "
                    "revision and the revision you want to "
                    "restore."
                )
            else:
                error = ""
                page = old_revision.page
                if request.method == "POST":
                    change_note = request.form.get("change_note", "")
                    change_note = "revert" + (change_note and ": " + change_note or "")
                    session.add(Revision(page, old_revision.text, change_note))
                    session.commit()
                    return redirect(href(page_name))

    return Response(
        generate_template(
            "action_revert.html", error=error, old_revision=old_revision, page=page
        )
    )
1037202
public function removeRevisionEntity(\ZF\Doctrine\Audit\Entity\RevisionEntity $revisionEntity)
    {
        $this->revisionEntity->removeElement($revisionEntity);
    }
954068
protected function _saveRevision(Entity $entity)
    {
        if ($entity->isNew()) {
            return;
        }

        try {
            $prev = TableRegistry::get('Content.Contents')->get($entity->id);
            $hash = $this->_calculateHash($prev);
            $exists = $this->ContentRevisions->exists([
                'ContentRevisions.content_id' => $entity->id,
                'ContentRevisions.hash' => $hash,
            ]);

            if (!$exists) {
                $revision = $this->ContentRevisions->newEntity([
                    'content_id' => $prev->id,
                    'summary' => $entity->get('edit_summary'),
                    'data' => $prev,
                    'hash' => $hash,
                ]);

                if (!$this->ContentRevisions->hasBehavior('Timestamp')) {
                    $this->ContentRevisions->addBehavior('Timestamp');
                }
                $this->ContentRevisions->save($revision);
            }
        } catch (\Exception $ex) {
            // unable to create content's review
        }
    }
283454
def revision(directory, message, autogenerate, sql, head, splice, branch_label,
             version_path, rev_id):
    """"""
    _revision(directory, message, autogenerate, sql, head, splice,
              branch_label, version_path, rev_id)
663693
private function _commitObject($id, $revision)
    {
        $update = '';
        //if version tracking is disabled, delete previous revisions of the object
        if (!$this->_options->versionTracking) {
            $update .= Statement::get(
                'DELETE_OBJECT_EXCEPT_REVISION',
                [
                    '@collection' => $this->_name,
                    '@id' => $this->_connector->quote($id),
                    '@revision' => $this->_connector->quote($revision)
                ]
            );
        }
        $update .= Statement::get(
            'UPDATE_OBJECT_TO_COMMITTED',
            [
                '@collection' => $this->_name,
                '@id' => $this->_connector->quote($id),
                '@revision' => $this->_connector->quote($revision)
            ]
        );

        $this->_connector->exec($update);
    }
1196856
public function update(Revision $revision)
    {
        switch ($revision->getState()) {
            case Revision::STATE_ADDED:
                throw new ClassContentException('Content is not versioned yet', ClassContentException::REVISION_ADDED);
                break;

            case Revision::STATE_MODIFIED:
                try {
                    $this->checkContent($revision);
                    throw new ClassContentException(
                        'Content is already up-to-date',
                        ClassContentException::REVISION_UPTODATE
                    );
                } catch (ClassContentException $e) {
                    if (ClassContentException::REVISION_OUTOFDATE == $e->getCode()) {
                        return $this->loadSubcontents($revision);
                    } else {
                        throw $e;
                    }
                }
                break;

            case Revision::STATE_CONFLICTED:
                throw new ClassContentException(
                    'Content is in conflict, resolve or revert it',
                    ClassContentException::REVISION_CONFLICTED
                );
                break;
        }

        throw new ClassContentException('Content is already up-to-date', ClassContentException::REVISION_UPTODATE);
    }
1248490
public function getUserId($revision = null)
	{
		// Without revision, use current info
		if (!isset($revision)) {
			return (int)$this->info['userid'];
		}

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

		return (int)$info['userid'];
	}