# Path: src/rosrepo/ui.py
# def ask_personal_access_token(domain):
#     if not isatty(sys.stdin):
#         fatal("Need TTY to query credentials\n")
#     if isatty(sys.stderr):
#         fd = sys.stderr
#     elif isatty(sys.stdout):
#         fd = sys.stdout
#     else:
#         fatal("Need TTY to query credentials\n")
#     msg("\n@!Authentication required for @{cf}%s\n" % domain, fd=fd)
#     return readline("Personal Access Token: ", fd=fd)
# 
# def ask_username_and_password(domain):
#     if not isatty(sys.stdin):
#         fatal("Need TTY to query credentials\n")
#     if isatty(sys.stderr):
#         fd = sys.stderr
#     elif isatty(sys.stdout):
#         fd = sys.stdout
#     else:
#         fatal("Need TTY to query credentials\n")
#     msg("\n@!Authentication required for @{cf}%s\n" % domain, fd=fd)
#     while True:
#         login = readline("Username: ", fd=fd)
#         if login == "":
#             continue
#         passwd = getpass("Password: ")
#         if passwd == "":
#             msg("Starting over\n\n", fd=fd)
#             continue
#         return login, passwd
# 
# def msg(text, max_width=None, use_color=None, wrap=True, fd=None, **wrap_args):
#     from .terminal_color import ansi
#     if fd is None:
#         fd = sys.stderr
#     if use_color is None:
#         use_color = isatty(fd)
#     ansi_text = color_fmt(text, use_color=use_color)
#     if wrap:
#         try:
#             if max_width is None:
#                 max_width, _ = get_terminal_size()
#         except OSError:
#             pass
#     fd.write(wrap_ansi_text(ansi_text, max_width, **wrap_args) + (ansi('reset') if use_color else ""))
# 
# def warning(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{yf}%s: warning: %s" % (prog, text), use_color=use_color, indent_next=len(prog) + 11)
# 
# def error(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{rf}%s: error: %s" % (prog, text), indent_next=len(prog) + 9)
# 
# def fatal(text):
#     raise UserError(text)
# 
# Path: src/rosrepo/util.py
# def yaml_load(stream, Loader=SafeLoader):
# def yaml_dump(data, stream=None, Dumper=SafeDumper, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __str__(self):
#     def __getitem__(self, item):
#     def __setitem__(self, item, value):
#     def __len__(self):
# def is_deprecated_package(manifest):
# def deprecated_package_info(manifest):
# def path_has_prefix(path, prefix):
# def has_package_path(obj, paths):
# def env_path_list_contains(path_list, path):
# def makedirs(path):
# def write_atomic(filepath, data, mode=0o644, ignore_fail=False):
# def isatty(fd):
# def get_terminal_size():
# def find_program(program):
#     def is_exe(fpath):
# def getmtime(path):
# def call_process(args, bufsize=0, stdin=None, stdout=None, stderr=None, cwd=None, env=None, input_data=None):
# def create_multiprocess_manager():
# def _worker_init(worker_init, worker_init_args):
# def run_multiprocess_workers(worker, workload, worker_init=None, worker_init_args=(), jobs=None, timeout=None):
# class NamedTuple(object):
# class UserError(RuntimeError):


import requests
import sys
import os
import concurrent.futures
from pygit2 import Repository
    from scandir import walk as os_walk
    from os import walk as os_walk
from dateutil.parser import parse as date_parse
    from urllib import quote as urlquote
    from urllib.parse import quote as urlquote
from catkin_pkg.package import parse_package_string, InvalidPackage, PACKAGE_MANIFEST_FILENAME
    from urlparse import urljoin, urlsplit
    from urllib.parse import urljoin, urlsplit
from .ui import ask_personal_access_token, ask_username_and_password, msg, warning, error, fatal
from .util import iteritems, NamedTuple, yaml_dump
except ImportError:

try:
except ImportError:



GITLAB_PACKAGE_CACHE_VERSION = 4


class GitlabServer(NamedTuple):
    __slots__ = ("projects", "last_modified")


class GitlabProject(NamedTuple):
    __slots__ = (
        "server", "name", "id", "website", "url", "packages",
        "last_modified", "workspace_path", "master_branch",
        "server_path"
    )

    def __cmp__(self, other):
        if not hasattr(other, "server") or not hasattr(other, "id"):
            return NotImplemented
        c = cmp(self.server, other.server)
        if c != 0:
            return c
        return cmp(self.id, other.id)



# Path: src/rosrepo/ui.py
# def ask_personal_access_token(domain):
#     if not isatty(sys.stdin):
#         fatal("Need TTY to query credentials\n")
#     if isatty(sys.stderr):
#         fd = sys.stderr
#     elif isatty(sys.stdout):
#         fd = sys.stdout
#     else:
#         fatal("Need TTY to query credentials\n")
#     msg("\n@!Authentication required for @{cf}%s\n" % domain, fd=fd)
#     return readline("Personal Access Token: ", fd=fd)
# 
# def ask_username_and_password(domain):
#     if not isatty(sys.stdin):
#         fatal("Need TTY to query credentials\n")
#     if isatty(sys.stderr):
#         fd = sys.stderr
#     elif isatty(sys.stdout):
#         fd = sys.stdout
#     else:
#         fatal("Need TTY to query credentials\n")
#     msg("\n@!Authentication required for @{cf}%s\n" % domain, fd=fd)
#     while True:
#         login = readline("Username: ", fd=fd)
#         if login == "":
#             continue
#         passwd = getpass("Password: ")
#         if passwd == "":
#             msg("Starting over\n\n", fd=fd)
#             continue
#         return login, passwd
# 
# def msg(text, max_width=None, use_color=None, wrap=True, fd=None, **wrap_args):
#     from .terminal_color import ansi
#     if fd is None:
#         fd = sys.stderr
#     if use_color is None:
#         use_color = isatty(fd)
#     ansi_text = color_fmt(text, use_color=use_color)
#     if wrap:
#         try:
#             if max_width is None:
#                 max_width, _ = get_terminal_size()
#         except OSError:
#             pass
#     fd.write(wrap_ansi_text(ansi_text, max_width, **wrap_args) + (ansi('reset') if use_color else ""))
# 
# def warning(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{yf}%s: warning: %s" % (prog, text), use_color=use_color, indent_next=len(prog) + 11)
# 
# def error(text, use_color=None):
#     prog = "rosrepo"
#     msg("@!@{rf}%s: error: %s" % (prog, text), indent_next=len(prog) + 9)
# 
# def fatal(text):
#     raise UserError(text)
# 
# Path: src/rosrepo/util.py
# def yaml_load(stream, Loader=SafeLoader):
# def yaml_dump(data, stream=None, Dumper=SafeDumper, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __str__(self):
#     def __getitem__(self, item):
#     def __setitem__(self, item, value):
#     def __len__(self):
# def is_deprecated_package(manifest):
# def deprecated_package_info(manifest):
# def path_has_prefix(path, prefix):
# def has_package_path(obj, paths):
# def env_path_list_contains(path_list, path):
# def makedirs(path):
# def write_atomic(filepath, data, mode=0o644, ignore_fail=False):
# def isatty(fd):
# def get_terminal_size():
# def find_program(program):
#     def is_exe(fpath):
# def getmtime(path):
# def call_process(args, bufsize=0, stdin=None, stdout=None, stderr=None, cwd=None, env=None, input_data=None):
# def create_multiprocess_manager():
# def _worker_init(worker_init, worker_init_args):
# def run_multiprocess_workers(worker, workload, worker_init=None, worker_init_args=(), jobs=None, timeout=None):
# class NamedTuple(object):
# class UserError(RuntimeError):


# Path: src/rosrepo/gitlab.py
import requests
import sys
import os
import concurrent.futures
from pygit2 import Repository
    from scandir import walk as os_walk
    from os import walk as os_walk
from dateutil.parser import parse as date_parse
    from urllib import quote as urlquote
    from urllib.parse import quote as urlquote
from catkin_pkg.package import parse_package_string, InvalidPackage, PACKAGE_MANIFEST_FILENAME
    from urlparse import urljoin, urlsplit
    from urllib.parse import urljoin, urlsplit
from .ui import ask_personal_access_token, ask_username_and_password, msg, warning, error, fatal
from .util import iteritems, NamedTuple, yaml_dump

except ImportError:

try:
except ImportError:



GITLAB_PACKAGE_CACHE_VERSION = 4


class GitlabServer(NamedTuple):
    __slots__ = ("projects", "last_modified")


class GitlabProject(NamedTuple):
    __slots__ = (
        "server", "name", "id", "website", "url", "packages",
        "last_modified", "workspace_path", "master_branch",
        "server_path"
    )

    def __cmp__(self, other):
        if not hasattr(other, "server") or not hasattr(other, "id"):
            return NotImplemented
        c = cmp(self.server, other.server)
        if c != 0:
            return c
        return cmp(self.id, other.id)



class GitlabPackage(NamedTuple):