def init_repository(folder): """ Creates a new repository. The specified folder should point to the .filer directory in which the repository should be created. """ # TODO: Consider using a neo4j repository for the prototype. It'd make a # lot of stuff simpler and would do away with pretty much all of the # maintenance folders (numbers, numbersbyrev, changeparents, # changechildren, dirparents, and dirchildren). folder = File(folder) if folder.exists: raise Exception("There's already a filer repository at that location.") folder.mkdirs(True)
def run(self, args): location = File(args.location) if args.plain: repository_folder = location else: location.mkdirs() repository_folder = location.child(".filer") init_repository(repository_folder) if not args.plain: repository = Repository(repository_folder) working = WorkingCopy(repository, location) working.create() print "Repository created at %r." % repository_folder.path