Revert an old revision.
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
        )
    )
633480
def post_revert(self, post_id, version_id):
        
        return self._get('posts/{0}/revert.json'.format(post_id),
                         {'version_id': version_id}, 'PUT', auth=True)
564
public function revert() {
		if ($this->data()->IsModifiedOnStage) {
			$this->data()->doRevertToLive();
		}
		return $this->redirect($this->data()->Link() . '?stage=Live');
	}
509484
public void undo() {

        if (hasUndo()) {
            ChangeType type = m_current.getType();
            String entityId = m_current.getEntityId();
            String attributeName = m_current.getAttributeName();
            int valueIndex = m_current.getValueIndex();
            m_redo.push(m_current);
            m_current = m_undo.pop();
            changeEntityContentValues(m_current.getEntityData(), entityId, attributeName, valueIndex, type);
            fireStateChange();
        }
    }
238404
function revert(h, node) {
    var subtype = node.referenceType
    var suffix = ']'
    var contents
    var head
    var tail

    if (subtype === 'collapsed') {
        suffix += '[]'
    } else if (subtype === 'full') {
        suffix += '[' + node.identifier + ']'
    }

    if (node.type === 'imageReference') {
        return u('text', '![' + node.alt + suffix)
    }

    contents = all(h, node)
    head = contents[0]

    if (head && head.type === 'text') {
        head.value = '[' + head.value
    } else {
        contents.unshift(u('text', '['))
    }

    tail = contents[contents.length - 1]

    if (tail && tail.type === 'text') {
        tail.value += suffix
    } else {
        contents.push(u('text', suffix))
    }

    return contents
}
53323
void rollback()
	{
		switch (data_type)
		{
		case Tango_DEV_BOOLEAN :
			bool_val = old_bool_val;
			break;
		
		case Tango_DEV_SHORT :
			short_val = old_short_val;
			break;
		
		case Tango_DEV_LONG :
			long_val = old_long_val;
			break;
		
		case Tango_DEV_LONG64 :
			long64_val = old_long64_val;
			break;
		
		case Tango_DEV_DOUBLE :
			double_val = old_double_val;
			break;
		
		case Tango_DEV_STRING :
			str_val = old_str_val;
			break;
		}
	}
1337127
def revert(self):
        """"""
        index = self.get_stack_index()
        finfo = self.data[index]
        filename = finfo.filename
        if finfo.editor.document().isModified():
            self.msgbox = QMessageBox(
                    QMessageBox.Warning,
                    self.title,
                    _("All changes to <b>%s</b> will be lost."
                      "<br>Do you want to revert file from disk?"
                      ) % osp.basename(filename),
                    QMessageBox.Yes | QMessageBox.No,
                    self)
            answer = self.msgbox.exec_()
            if answer != QMessageBox.Yes:
                return
        self.reload(index)
548538
def versions(self, rev=None, index=None):
        """"""
        raise NotImplementedError
        _revisions = [line.split()[0] for line in self.log.split('\n') if line]
        _versions = [Version(self.obj.repo.commit(r)) for r in _revisions if rev is None or r.startswith(rev)]
        if index is not None and len(_versions) > index:
            _versions = _versions[index]
        return _versions
43280
def downgrade():
    """"""
    # Remove 'created' and 'updated' columns
    op.drop_column('oauthclient_remoteaccount', 'created')
    op.drop_column('oauthclient_remoteaccount', 'updated')

    op.drop_column('oauthclient_remotetoken', 'created')
    op.drop_column('oauthclient_remotetoken', 'updated')

    op.drop_column('oauthclient_useridentity', 'created')
    op.drop_column('oauthclient_useridentity', 'updated')
879158
def downgrade(directory, sql, tag, x_arg, revision):
    """"""
    _downgrade(directory, revision, sql, tag, x_arg)
242292
def clean_up(self):
        """"""
        self.action_buffer = []
        self.sources = {}
        self.doc_to_get = {}
        self.doc_to_update = []
234819
public void revertImplementation(Page page) {
        Integer previousImplementedVersion = getPreviousImplementedVersion(page);
        if (previousImplementedVersion != null) {
            saveImplementedVersion(page, previousImplementedVersion);
            savePreviousImplementedVersion(page, null);
        }
    }
1036599
public final void revert() {
        if (isBuffering()) {
            if (logger.isDebugEnabled()) {
                logger.debug("Reverting buffered value '" + getValue() + "' to value '" + wrappedModel.getValue() + "'");
            }
            setValue(wrappedModel.getValue());
        }
        else {
            if (logger.isDebugEnabled()) {
                logger.debug("No buffered edit to commit; nothing to do...");
            }
        }
    }
212997
def revert(self):
        
        if self.program_fp:
            self.program_fp.close()
        super(ProgramRunner, self).revert()
1346801
def revert(self, filename=None,
               ignore_discard=False, ignore_expires=False):
        
        if filename is None:
            if self.filename is not None: filename = self.filename
            else: raise ValueError(MISSING_FILENAME_TEXT)

        self._cookies_lock.acquire()
        try:

            old_state = copy.deepcopy(self._cookies)
            self._cookies = {}
            try:
                self.load(filename, ignore_discard, ignore_expires)
            except (LoadError, IOError):
                self._cookies = old_state
                raise

        finally:
            self._cookies_lock.release()
548410
function revertFromTemporaryVersion()
    {
        $temporaryVersion = eZRole::fetch( 0, $this->attribute( 'id' ) );
        if ( $temporaryVersion === null )
            return 0;
        $this->removePolicies();
        $this->setAttribute( 'name', $temporaryVersion->attribute( 'name') );
        $this->setAttribute( 'is_new', 0 );

        $db = eZDB::instance();
        $db->begin();
        $this->store();

        $query = "UPDATE  ezpolicy
                  SET role_id = " . $this->attribute( 'id' ) . "
                  WHERE role_id = " . $temporaryVersion->attribute( 'id' );
        $db->query( $query );
        $temporaryVersion->removePolicies( false );
        $temporaryVersion->remove();
        $db->commit();

        // Expire role cache
        $handler = eZExpiryHandler::instance();
        $handler->setTimestamp( 'user-info-cache', time() );
        $handler->setTimestamp( 'user-class-cache', time() );
        $handler->store();
    }
992910
def revision(directory=None, message=None, autogenerate=False, sql=False,
             head='head', splice=False, branch_label=None, version_path=None,
             rev_id=None):
    """"""
    config = current_app.extensions['migrate'].migrate.get_config(directory)
    if alembic_version >= (0, 7, 0):
        command.revision(config, message, autogenerate=autogenerate, sql=sql,
                         head=head, splice=splice, branch_label=branch_label,
                         version_path=version_path, rev_id=rev_id)
    else:
        command.revision(config, message, autogenerate=autogenerate, sql=sql)