Esempio n. 1
0
 def create_base(self) -> VersionAgent:
     """Create the base version."""
     if self.base_version is None:
         create_version(True, self)
     else:
         ABUNDANT_LOGGER.warning('Cannot create duplicate base versions')
     self.load_versions()
     return self.base_version
Esempio n. 2
0
 def create_version(self) -> VersionAgent:
     """Add a new version."""
     if self.max_number_of_versions == 1:
         self.base_version.remove()
         self.create_base()
     else:
         while len(self.versions) >= self.max_number_of_versions:
             self.migrate_oldest_version_to_base()
         if self.base_version is None:
             ABUNDANT_LOGGER.warning('Cannot create non-base versions without a base version')
         else:
             create_version(False, self)
     self.load_versions()
     return self.versions[-1]