Produces same action as kubectl rollout undo deployment command.
        Input variable is revision to rollback to (in kubectl, --to-revision)
175134
def rollout_undo(self, target_revision=None):
        
        if target_revision is None:
            revision = {}
        else:
            revision = {
                "revision": target_revision
            }

        params = {
            "kind": "DeploymentRollback",
            "apiVersion": self.version,
            "name": self.name,
            "rollbackTo": revision
        }

        kwargs = {
            "version": self.version,
            "namespace": self.namespace,
            "operation": "rollback",
        }
        r = self.api.post(**self.api_kwargs(data=json.dumps(params), **kwargs))
        r.raise_for_status()
        return r.text
199801
public function rollback(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        if (!isset($options['rollbackCommand'])) {
            return;
        }

        $replacePaths = [
            '{deploymentPath}' => $application->getDeploymentPath(),
            '{sharedPath}' => $application->getSharedPath(),
            '{releasePath}' => $deployment->getApplicationReleasePath($application),
            '{currentPath}' => $application->getReleasesPath() . '/current',
            '{previousPath}' => $application->getReleasesPath() . '/previous'
        ];

        $command = $options['rollbackCommand'];
        $command = str_replace(array_keys($replacePaths), $replacePaths, $command);

        $this->shell->execute($command, $node, $deployment, true);
    }
1063195
def cmd_rollback(context):
  
  last_stable = get_versions(context, return_stable=True)
  if len(last_stable) != 1:
    fail("Didn't find a version marked stable for key: {} in env/service: {}/{}".format(
         context.key, context.env, context.service_name))
  context.value = last_stable[0].value
  context.commit_hash = last_stable[0].commit_hash
  context.build_number = last_stable[0].build_number
  context.location = last_stable[0].location
  context.stable = True
  cmd_set(context)
716392
def rollback(self):
        """"""
        commands = []
        commands.append('configure replace flash:rollback-0')
        commands.append('write memory')
        self.device.run_commands(commands)
5631
function cb (err) {
    if (cb.done) return
    cb.done = true
    if (err) {
      log.warn('install', 'got an error, rolling back install')
      // roll-back the install if anything went wrong
      gyp.commands.remove([ release.versionDir ], function () {
        callback(err)
      })
    } else {
      callback(null, release.version)
    }
  }
962896
def rollback():
    

    init_tasks()

    run_hook("before_rollback")

    # Remove current version
    current_release = paths.get_current_release_path()
    if current_release:
        env.run("rm -rf %s" % current_release)

    # Restore previous version
    old_release = paths.get_current_release_name()
    if old_release:
        paths.symlink(paths.get_source_path(old_release),
                      paths.get_current_path())

    run_hook("rollback")
    run_hook("after_rollback")

    logger.info("Rollback complete")
267186
private RollingUpdateOp rollingUpdateUndeploy(final ZooKeeperClient client,
                                                final RollingUpdateOpFactory opFactory,
                                                final DeploymentGroup deploymentGroup,
                                                final String host) {
    return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, true);
  }
385800
function UndoManager(callback, panels) {

        var undoObj = this;
        var undoStack = []; // A stack of undo states
        var stackPtr = 0; // The index of the current state
        var mode = "none";
        var lastState; // The last state
        var timer; // The setTimeout handle for cancelling the timer
        var inputStateObj;

        // Set the mode for later logic steps.
        var setMode = function (newMode, noSave) {
            if (mode != newMode) {
                mode = newMode;
                if (!noSave) {
                    saveState();
                }
            }

            if (!uaSniffed.isIE || mode != "moving") {
                timer = setTimeout(refreshState, 1);
            }
            else {
                inputStateObj = null;
            }
        };

        var refreshState = function (isInitialState) {
            inputStateObj = new TextareaState(panels, isInitialState);
            timer = undefined;
        };

        this.setCommandMode = function () {
            mode = "command";
            saveState();
            timer = setTimeout(refreshState, 0);
        };

        this.canUndo = function () {
            return stackPtr > 1;
        };

        this.canRedo = function () {
            if (undoStack[stackPtr + 1]) {
                return true;
            }
            return false;
        };

        // Removes the last state and restores it.
        this.undo = function () {

            if (undoObj.canUndo()) {
                if (lastState) {
                    // What about setting state -1 to null or checking for undefined?
                    lastState.restore();
                    lastState = null;
                }
                else {
                    undoStack[stackPtr] = new TextareaState(panels);
                    undoStack[--stackPtr].restore();

                    if (callback) {
                        callback();
                    }
                }
            }

            mode = "none";
            panels.input.focus();
            refreshState();
        };

        // Redo an action.
        this.redo = function () {

            if (undoObj.canRedo()) {

                undoStack[++stackPtr].restore();

                if (callback) {
                    callback();
                }
            }

            mode = "none";
            panels.input.focus();
            refreshState();
        };

        // Push the input area state to the stack.
        var saveState = function () {
            var currState = inputStateObj || new TextareaState(panels);

            if (!currState) {
                return false;
            }
            if (mode == "moving") {
                if (!lastState) {
                    lastState = currState;
                }
                return;
            }
            if (lastState) {
                if (undoStack[stackPtr - 1].text != lastState.text) {
                    undoStack[stackPtr++] = lastState;
                }
                lastState = null;
            }
            undoStack[stackPtr++] = currState;
            undoStack[stackPtr + 1] = null;
            if (callback) {
                callback();
            }
        };

        var handleCtrlYZ = function (event) {

            var handled = false;

            if (event.ctrlKey || event.metaKey) {

                // IE and Opera do not support charCode.
                var keyCode = event.charCode || event.keyCode;
                var keyCodeChar = String.fromCharCode(keyCode);

                switch (keyCodeChar) {

                    case "y":
                        undoObj.redo();
                        handled = true;
                        break;

                    case "z":
                        if (!event.shiftKey) {
                            undoObj.undo();
                        }
                        else {
                            undoObj.redo();
                        }
                        handled = true;
                        break;
                }
            }

            if (handled) {
                if (event.preventDefault) {
                    event.preventDefault();
                }
                if (window.event) {
                    window.event.returnValue = false;
                }
                return;
            }
        };

        // Set the mode depending on what is going on in the input area.
        var handleModeChange = function (event) {

            if (!event.ctrlKey && !event.metaKey) {

                var keyCode = event.keyCode;

                if ((keyCode >= 33 && keyCode <= 40) || (keyCode >= 63232 && keyCode <= 63235)) {
                    // 33 - 40: page up/dn and arrow keys
                    // 63232 - 63235: page up/dn and arrow keys on safari
                    setMode("moving");
                }
                else if (keyCode == 8 || keyCode == 46 || keyCode == 127) {
                    // 8: backspace
                    // 46: delete
                    // 127: delete
                    setMode("deleting");
                }
                else if (keyCode == 13) {
                    // 13: Enter
                    setMode("newlines");
                }
                else if (keyCode == 27) {
                    // 27: escape
                    setMode("escape");
                }
                else if ((keyCode < 16 || keyCode > 20) && keyCode != 91) {
                    // 16-20 are shift, etc. 
                    // 91: left window key
                    // I think this might be a little messed up since there are
                    // a lot of nonprinting keys above 20.
                    setMode("typing");
                }
            }
        };

        var setEventHandlers = function () {
            util.addEvent(panels.input, "keypress", function (event) {
                // keyCode 89: y
                // keyCode 90: z
                if ((event.ctrlKey || event.metaKey) && (event.keyCode == 89 || event.keyCode == 90)) {
                    event.preventDefault();
                }
            });

            var handlePaste = function () {
                if (uaSniffed.isIE || (inputStateObj && inputStateObj.text != panels.input.value)) {
                    if (timer == undefined) {
                        mode = "paste";
                        saveState();
                        refreshState();
                    }
                }
            };

            util.addEvent(panels.input, "keydown", handleCtrlYZ);
            util.addEvent(panels.input, "keydown", handleModeChange);
            util.addEvent(panels.input, "mousedown", function () {
                setMode("moving");
            });

            panels.input.onpaste = handlePaste;
            panels.input.ondrop = handlePaste;
        };

        var init = function () {
            setEventHandlers();
            refreshState(true);
            saveState();
        };

        init();
    }
805136
def rollback(self, release):
        """"""
        r = self._h._http_resource(
            method='POST',
            resource=('apps', self.name, 'releases'),
            data={'rollback': release}
        )
        return self.releases[-1]
398244
def undo!(append: Logidze.append_on_undo)
      version = log_data.previous_version
      return false if version.nil?

      switch_to!(version.version, append: append)
    end
642637
def _rev(repo):
    '''
    
    '''
    try:
        repo_info = dict(six.iteritems(CLIENT.info(repo['repo'])))
    except (pysvn._pysvn.ClientError, TypeError,
            KeyError, AttributeError) as exc:
        log.error(
            'Error retrieving revision ID for svnfs remote %s '
            '(cachedir: %s): %s',
            repo['url'], repo['repo'], exc
        )
    else:
        return repo_info['revision'].number
    return None
692335
def pop(self):
        
        revisions = yield self.list()

        if len(revisions) > 0:
            revision = revisions[0]

            # Update type action
            if revision.get("action") == self.UPDATE_ACTION:
                try:
                    yield self.__update_action(revision)
                except Exception as ex:
                    self.logger.error(ex)

            # Insert type update
            if revision.get("action") == self.INSERT_ACTION:
                try:
                    yield self.__insert_action(revision)
                except Exception as ex:
                    self.logger.error(ex)

            #Get the updated object for attachment to the snapshot
            snapshot_object = yield self.collection.find_one_by_id(revision.get("master_id"))

            #Handle delete action here
            if revision.get("action") == self.DELETE_ACTION:
                try:
                    yield self.__delete_action(revision)
                except Exception as ex:
                    self.logger.error(ex)

                snapshot_object = None

            #Update the revision to be in a post-process state including snapshot
            revision_update_response = yield self.revisions.patch(revision.get("id"),
                {
                    "processed" : True,
                    "snapshot" : snapshot_object,
                    "inProcess": False
                }
            )

            if revision_update_response.get("n") == 0:
                raise RevisionUpdateFailed(msg="revision document update failed")

            revision = yield self.revisions.find_one_by_id(revision.get("id"))

            #TODO: Make this callback method something that can be passed in.  This was used in
            #the original implementation to send back to the client via websocket
            #revision_success.send('revision_success', type="RevisionSuccess", data=revision)

            raise Return(revision)

        raise Return(None)
106668
def rollout(self, **kwargs):
        
        if kwargs.has_key('tau'):
            timesteps = int(self.timesteps / kwargs['tau'])
        else: 
            timesteps = self.timesteps
        self.x_track = np.zeros(timesteps)
        
        self.reset_state()
        for t in range(timesteps):
            self.x_track[t] = self.x 
            self.step(**kwargs)

        return self.x_track
1308496
def build_down_commands
      rollbacks = rollback_versions.map{ |v| RollbackCommand.new(v) }
      missing = missing_versions_before(rollbacks.last.version).map{ |v| ApplyCommand.new(v) }
      rollbacks + missing
    end
749857
boolean undoChanges() {
        final State state = stateUpdater.getAndSet(this, State.ROLLBACK_ONLY);
        if (state == State.COMPLETED || state == State.ROLLBACK_ONLY) {
            // Was actually completed already
            return false;
        }
        PatchingTaskContext.Mode currentMode = this.mode;
        mode = PatchingTaskContext.Mode.UNDO;
        final PatchContentLoader loader = PatchContentLoader.create(miscBackup, null, null);
        // Undo changes for the identity
        undoChanges(identityEntry, loader);
        // TODO maybe check if we need to do something for the layers too !?
        if (state == State.INVALIDATE || currentMode == PatchingTaskContext.Mode.ROLLBACK) {
            // For apply the state needs to be invalidate
            // For rollback the files are invalidated as part of the tasks
            final PatchingTaskContext.Mode mode = currentMode == PatchingTaskContext.Mode.APPLY ? PatchingTaskContext.Mode.ROLLBACK : PatchingTaskContext.Mode.APPLY;
            for (final File file : moduleInvalidations) {
                try {
                    PatchModuleInvalidationUtils.processFile(this, file, mode);
                } catch (Exception e) {
                    PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
                }
            }
            if(!modulesToReenable.isEmpty()) {
                for (final File file : modulesToReenable) {
                    try {
                        PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.APPLY);
                    } catch (Exception e) {
                        PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
                    }
                }
            }
            if(!modulesToDisable.isEmpty()) {
                for (final File file : modulesToDisable) {
                    try {
                        PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.ROLLBACK);
                    } catch (Exception e) {
                        PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
                    }
                }
            }
        }
        return true;
    }
796564
function rollbackPublish() {
			try {
				chkoutRun(options.distBranch, function() {
					var cph = cmd('git rev-parse HEAD');
					if (pubHash && pubHash !== cph) {
						cmd('git checkout -qf ' + pubHash);
						cmd('git commit -q -m "Rollback: ' + tmpltData.distBranchPubMsg + '"');
						cmd('git push -f ' + options.repoName + ' ' + options.distBranch);
					} else if (!pubHash) {
						cmd('git push ' + options.repoName + ' --delete ' + options.distBranch);
					} else {
						rbot.log.verbose('Skipping rollback for ' + options.distBranch + ' for hash "' + pubHash
								+ '" (current hash: "' + cph + '")');
					}
				});
			} catch (e) {
				var msg = 'Failed to rollback publish branch changes!';
				rollCall.error(msg, e);
			}
		}
662448
def modify_no_rollback(self, dn: str, mod_list: dict):
        

        _debug("modify_no_rollback", self, dn, mod_list)
        result = self._do_with_retry(lambda obj: obj.modify_s(dn, mod_list))
        _debug("--")

        return result