def print_status(self, fetch=False): """Print clowder repo status""" repo_path = os.path.join(self.root_directory, '.clowder') if not ProjectRepo.existing_git_repository(repo_path): output = colored('.clowder', 'green') print(output) return if not is_offline() and fetch: print(' - Fetch upstream changes for clowder repo') repo = ProjectRepo(self.clowder_path, self.remote, self.default_ref) repo.fetch(self.remote) project_output = ProjectRepo.format_project_string(repo_path, '.clowder') current_ref_output = ProjectRepo.format_project_ref_string(repo_path) clowder_symlink = os.path.join(self.root_directory, 'clowder.yaml') if not os.path.islink(clowder_symlink): print(project_output + ' ' + current_ref_output) return real_path = os.path.realpath(clowder_symlink) symlink_output = fmt.path('clowder.yaml') clowder_path = fmt.remove_prefix(real_path + '/', self.root_directory) path_output = fmt.path(clowder_path[1:-1]) print(project_output + ' ' + current_ref_output) print(symlink_output + ' -> ' + path_output + '\n')
def status(self): """Return formatted fork status""" if not ProjectRepo.existing_git_repository(self.path): return colored(self.path, 'green') project_output = ProjectRepo.format_project_string(self.path, self.path) current_ref_output = ProjectRepo.format_project_ref_string(self.full_path()) return project_output + ' ' + current_ref_output
def start(self, branch, tracking): """Start a new feature branch""" if not ProjectRepo.existing_git_repository(self.full_path()): print(colored(" - Directory doesn't exist", 'red')) return remote = self._remote if self.fork is None else self.fork.remote_name depth = self._depth if self.fork is None else 0 repo = ProjectRepo(self.full_path(), self._remote, self._ref) repo.start(remote, branch, depth, tracking)
def prune(self, branch, force=False, local=False, remote=False): """Prune branch""" if not ProjectRepo.existing_git_repository(self.full_path()): return if local and remote: self._prune_local(branch, force) self._prune_remote(branch) elif local: self._prune_local(branch, force) elif remote: self._prune_remote(branch)
def status(self, padding=None): """Return formatted status for project""" if not ProjectRepo.existing_git_repository(self.full_path()): print(colored(self.name, 'green')) return project_output = ProjectRepo.format_project_string( self.full_path(), self.path) current_ref_output = ProjectRepo.format_project_ref_string( self.full_path()) if padding: project_output = project_output.ljust(padding) return project_output + ' ' + current_ref_output