def wrapper(repo_path): eg = EasyGit.open_repo(repo_path) if 'features' not in eg.root: upgrade_log.info('Creating "features" blob for repository %r', repo_path) b = eg.root.new_blob('features') b.data = '{}' features = FeatureBlob(eg.root['features']) for name, value in upgrade_from.iteritems(): if features.get(name, None) is not value: upgrade_log.debug( 'Skipping upgrade %r on repository %r, ' 'feature %r is not %r', upgrade_name, repo_path, name, value) return upgrade_log.info('Starting upgrade %r on repository %r', upgrade_name, repo_path) the_upgrade(eg) upgrade_log.debug('Writing features for upgrade %r', upgrade_name) for name, value in upgrade_to.iteritems(): features[name] = value message = "Update script %r" % upgrade_name eg.commit(GitStorage.commit_author, message, [eg.get_head_id('master')]) upgrade_log.info('Finished upgrade %r on repository %r', upgrade_name, repo_path)
def wrapper(repo_path): eg = EasyGit.open_repo(repo_path) if 'features' not in eg.root: upgrade_log.info('Creating "features" blob for repository %r', repo_path) b = eg.root.new_blob('features') b.data = '{}' features = FeatureBlob(eg.root['features']) for name, value in upgrade_from.iteritems(): if features.get(name, None) is not value: upgrade_log.debug('Skipping upgrade %r on repository %r, ' 'feature %r is not %r', upgrade_name, repo_path, name, value) return upgrade_log.info('Starting upgrade %r on repository %r', upgrade_name, repo_path) the_upgrade(eg) upgrade_log.debug('Writing features for upgrade %r', upgrade_name) for name, value in upgrade_to.iteritems(): features[name] = value message = "Update script %r" % upgrade_name eg.commit(GitStorage.commit_author, message, [eg.get_head_id('master')]) upgrade_log.info('Finished upgrade %r on repository %r', upgrade_name, repo_path)
def __init__(self, repo_path, autocommit=True): self.eg = EasyGit.open_repo(repo_path) features = FeatureBlob(self.eg.root['features']) assert features.get('inode_format', None) == 'treetree' assert features.get('inode_index_format', None) == 'treetree' self.autocommit = autocommit log.debug('Loaded storage, autocommit=%r, HEAD=%r', autocommit, self.eg.get_head_id()) self._inode_cache = {} self._inodes_tt = TreeTree(self.eg.root['inodes'], prefix='it')
def create(cls, repo_path): if not os.path.isdir(repo_path): os.mkdir(repo_path) eg = EasyGit.new_repo(repo_path, bare=True) inodes = eg.root.new_tree('inodes') root_ls = eg.root.new_blob('root.ls') root_sub = eg.root.new_tree('root.sub') features_blob = eg.root.new_blob('features') features_blob.data = '{}' features = FeatureBlob(features_blob) features['next_inode_number'] = 1 features['inode_index_format'] = 'treetree' features['inode_format'] = 'treetree' eg.commit(cls.commit_author, 'Created empty filesystem') return cls(repo_path)