def herd(self): """clowder herd command""" self._validate_clowder_yaml() if self.clowder_repo is None: exit_clowder_not_found() self.clowder_repo.print_status(fetch=True) if is_offline(): print(fmt.offline_error()) sys.exit(1) if self.clowder is None: sys.exit(1) branch = None if self.args.branch is None else self.args.branch[0] tag = None if self.args.tag is None else self.args.tag[0] depth = None if self.args.depth is None else self.args.depth[0] args = { 'group_names': self.args.groups, 'project_names': self.args.projects, 'skip': self.args.skip, 'branch': branch, 'tag': tag, 'depth': depth, 'rebase': self.args.rebase } if self.args.parallel: self.clowder.herd_parallel(**args) return self.clowder.herd(**args)
def wrapper(*args, **kwargs): """Wrapper :raise ClowderExit: """ if is_offline(): print(fmt.offline_error()) raise ClowderExit(1) return func(*args, **kwargs)
def prune(self): """clowder prune command""" self._validate_clowder_yaml() if self.clowder_repo is None: exit_clowder_not_found() self.clowder_repo.print_status() if self.clowder is None: sys.exit(1) if self.args.all: if is_offline(): print(fmt.offline_error()) sys.exit(1) self.clowder.prune(self.args.groups, self.args.branch, project_names=self.args.projects, skip=self.args.skip, force=self.args.force, local=True, remote=True) return if self.args.remote: if is_offline(): print(fmt.offline_error()) sys.exit(1) self.clowder.prune(self.args.groups, self.args.branch, project_names=self.args.projects, skip=self.args.skip, remote=True) return self.clowder.prune(self.args.groups, self.args.branch, project_names=self.args.projects, skip=self.args.skip, force=self.args.force, local=True)
def repo_push(self): """clowder repo push command""" if self.clowder_repo is None: exit_clowder_not_found() if is_offline(): print(fmt.offline_error()) sys.exit(1) self.clowder_repo.print_status(fetch=True) self.clowder_repo.push()
def init(self): """clowder init command""" if self.clowder_repo: cprint('Clowder already initialized in this directory\n', 'red') sys.exit(1) if is_offline(): print(fmt.offline_error()) sys.exit(1) url_output = colored(self.args.url, 'green') print('Create clowder repo from ' + url_output + '\n') clowder_repo = ClowderRepo(self.root_directory) if self.args.branch is None: branch = 'master' else: branch = str(self.args.branch[0]) clowder_repo.init(self.args.url, branch)
def sync(self): """clowder sync command""" self._validate_clowder_yaml() if self.clowder_repo is None: exit_clowder_not_found() self.clowder_repo.print_status(fetch=True) if self.clowder is None: sys.exit(1) if is_offline(): print(fmt.offline_error()) sys.exit(1) all_fork_projects = self.clowder.get_all_fork_project_names() if all_fork_projects == '': cprint(' - No forks to sync\n', 'red') sys.exit() self.clowder.sync(all_fork_projects, rebase=self.args.rebase, parallel=self.args.parallel)
def status(self): """clowder status command""" self._validate_clowder_yaml() if self.clowder_repo is None: exit_clowder_not_found() self.clowder_repo.print_status(fetch=self.args.fetch) if self.clowder is None: sys.exit(1) if self.args.fetch: if is_offline(): print(fmt.offline_error()) sys.exit(1) print(' - Fetch upstream changes for projects\n') self.clowder.fetch(self.clowder.get_all_group_names()) all_project_paths = self.clowder.get_all_project_paths() padding = len(max(all_project_paths, key=len)) self.clowder.status(self.clowder.get_all_group_names(), padding)
def start(self): """clowder start command""" self._validate_clowder_yaml() if self.clowder_repo is None: exit_clowder_not_found() self.clowder_repo.print_status() if self.clowder is None: sys.exit(1) if self.args.tracking: if is_offline(): print(fmt.offline_error()) sys.exit(1) if self.args.projects is None: self.clowder.start_groups(self.args.groups, self.args.skip, self.args.branch, self.args.tracking) else: self.clowder.start_projects(self.args.projects, self.args.skip, self.args.branch, self.args.tracking)
def reset(self): """clowder reset command""" self._validate_clowder_yaml() if self.clowder_repo is None: exit_clowder_not_found() self.clowder_repo.print_status(fetch=True) if is_offline(): print(fmt.offline_error()) sys.exit(1) if self.clowder is None: sys.exit(1) timestamp_project = None if self.args.timestamp: timestamp_project = self.args.timestamp[0] self.clowder.reset(group_names=self.args.groups, project_names=self.args.projects, skip=self.args.skip, timestamp_project=timestamp_project, parallel=self.args.parallel)