def rollback(self):
        """Revert the previous modification to the refpkg.
        """
        # This is slightly complicated because of Python's freakish
        # assignment semantics and because we don't store multiple
        # copies of the log.
        if self.contents['rollback'] is None:
            raise ValueError("No operation to roll back on refpkg")
        future_msg = self.contents['log'][0]
        rolledback_log = self.contents['log'][1:]
        rollforward = copy.deepcopy(self.contents)
        rollforward.pop('rollback')
        self.contents = self.contents['rollback']
        self.contents['log'] = rolledback_log
        self.contents['rollforward'] = [future_msg, rollforward]
        self._sync_to_disk()
def rollback ( self ) : if self . contents [ 'rollback' ] is None : raise ValueError ( "No operation to roll back on refpkg" ) future_msg = self . contents [ 'log' ] [ 0 ] rolledback_log = self . contents [ 'log' ] [ 1 : ] rollforward = copy . deepcopy ( self . contents ) rollforward . pop ( 'rollback' ) self . contents = self . contents [ 'rollback' ] self . contents [ 'log' ] = rolledback_log self . contents [ 'rollforward' ] = [ future_msg , rollforward ] self . _sync_to_disk ( )
Revert the previous modification to the refpkg.