def update(self): if not self.isValid(): return False Repo.destroy(Game, self) Repo.create(Game, self) return True
def update(self): brand = Brand.find_by("id", self.id) if not self.isValid(): return False Repo.destroy(Brand, self) Repo.create(Brand, self) return True
def __init__(self, gitdir=None): self.gitdir = gitdir if not self.gitdir: self.gitdir = tempfile.mkdtemp() Repo.create(self.gitdir) self.repo = Repo(self.gitdir) self.fetch_objects = self.repo.fetch_objects self.get_refs = self.repo.get_refs
def main() -> None: args = docopt.docopt(__doc__, version=VERSION) logging.basicConfig(filename=LOG_FILE, filemode='a', format='%(levelname)s - %(message)s', level=LOG_LEVEL) now = time.asctime() logging.info(f'log start: {now}') logging.info(f'args: {args}') repo_file = args['REPO'] if args['create']: Repo.create(repo_file) elif args['verify']: repos = Repo(repo_file) logging.info(f'Verifying repo {repo_file}') n = 0 if args['--hashes']: repos.verify_all_hashes(delete=args['-d']) n += 1 if args['--backups']: repos.verify_backups() n += 1 if args['--orphans']: repos.find_orphans(delete=args['-d']) n += 1 if n == 0: util.msg('You must use --hashes, --backups, or --orphans') elif args['unlock']: # XXX Could this be: Repo(repo_file).unlock() ? repos = Repo(repo_file) repos.unlock() elif args['backup']: arg_prefix = args['--prefix'] prefix = arg_prefix if arg_prefix else 'backup' if not alphanum.match(prefix): util.fatal('prefix must be alphanumeric') want_verify = args['--verify'] backup.run_backup(args['--repo'], prefix, args['FILE'], verify=want_verify, verbose=args['-v']) elif args['restore']: restore.restore(repo_file) now = time.asctime() logging.info(f'log end: {now}')
def save(self): if not self.isValid(): return False Repo.create(Game, self) return True
def save(self): if not self.isValid(): return False Repo.create(Brand, self) return True