예제 #1
0
    def store(self, type, data, include=None, timestamp=None):
        """Create `type` revision and write `data` to disk"""

        # Create revision
        rev = Revision.create(self, type, include, timestamp)

        # Save data for revision
        return rev.write(data.items())
예제 #2
0
    def resolve(self):
        """Resolve revision history"""

        result = []

        for root, _, files in os.walk(self.destination):
            if root == self.destination:
                continue

            # Parse root directory name
            directory = os.path.basename(root)

            for filename in files:
                revision = Revision.parse(self, directory, filename)

                if not revision:
                    continue

                result.append(revision)

        # Sort backup history
        self.history = sorted(result, key=lambda x: x.timestamp, reverse=True)