def revert(self):
        for kind, entry in self:
            try:
                if kind == JOURNAL_ENTRY_BACKUP:
                    what = "restore"
                    path = self.root + entry.old()
                    os.rename(self.root + entry.new(), path)
                    os.chown(path, entry.inode.uid(), entry.inode.gid())
                    os.chmod(path, entry.inode.perms())
                    os.utime(path, (entry.inode.mtime(), entry.inode.mtime()))
                elif kind == JOURNAL_ENTRY_RENAME:
                    what = "restore"
                    os.rename(self.root + entry.new(), self.root + entry.old())
                elif kind == JOURNAL_ENTRY_CREATE:
                    what = "remove"
                    os.unlink(self.root + entry.new())
                elif kind == JOURNAL_ENTRY_MKDIR:
                    what = "remove"
                    os.rmdir(self.root + entry.new())
                elif kind == JOURNAL_ENTRY_REMOVE:
                    pass
                elif kind == JOURNAL_ENTRY_BACKDIR:
                    pass
                elif kind == JOURNAL_ENTRY_TRYCLEANUPDIR:
                    pass
                else:
                    self.callback.warning('unknown journal entry %d', kind)
            except __HOLE__, e:
                self.callback.warning('could not %s file %s: %s',
                                      what, self.root + entry.new(), e.strerror)
        self.close()
dataset/ETHPy150Open sassoftware/conary/conary/local/journal.py/JobJournal.revert