Exemplo n.º 1
0
 def status(self):
     """clowder status command"""
     if self.clowder_repo is not None:
         self.clowder_repo.print_status()
         print('')
         if self.args.fetch:
             print(' - Fetching upstream changes for projects', end="", flush=True)
             timer = RepeatedTimer(1, self._print_progress)
             if self.args.projects is None:
                 self.clowder.fetch_groups(self.args.groups)
             else:
                 self.clowder.fetch_projects(self.args.projects)
             timer.stop()
             print('\n')
         if self.args.projects is None:
             self.clowder.status_groups(self.args.groups, self.args.verbose)
         else:
             self.clowder.status_projects(self.args.projects, self.args.verbose)
     else:
         exit_clowder_not_found()
Exemplo n.º 2
0
    def print_status(self):
        """Print clowder repo status"""
        repo_path = os.path.join(self.root_directory, '.clowder')
        # FIXME: Probably should remove this as it assumes .clowder repo which isn't git directory
        if not os.path.isdir(os.path.join(repo_path, '.git')):
            output = colored('.clowder', 'green')
            print(output)
            return
        print(' - Fetching upstream changes for clowder repo', end="", flush=True)
        timer = RepeatedTimer(1, _print_progress)
        git_fetch(self.clowder_path)
        timer.stop()
        print("\n")
        project_output = format_project_string(repo_path, '.clowder')
        current_ref_output = format_ref_string(repo_path)

        clowder_symlink = os.path.join(self.root_directory, 'clowder.yaml')
        if os.path.islink(clowder_symlink):
            real_path = os.path.realpath(clowder_symlink)
            clowder_path = remove_prefix(real_path + '/', self.root_directory)
            path_output = colored(clowder_path[1:-1], 'cyan')
            print(project_output + ' ' + current_ref_output + ' ~~> ' + path_output)
        else:
            print(project_output + ' ' + current_ref_output)