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')
Beispiel #2
0
    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
Beispiel #3
0
    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