예제 #1
0
def prepare_components(args):
    commit_queue = CommitQueue()

    credentials = get_credentials(args)

    try:
        # setting router
        router = Router(remote_url=args.remote_url,
                        mount_path=args.mount_point,
                        current_path=args.current_path,
                        history_path=args.history_path,
                        repo_path=args.repo_path,
                        branch=args.branch,
                        user=args.user,
                        group=args.group,
                        max_size=args.max_size * 1024 * 1024,
                        max_offset=args.max_size * 1024 * 1024,
                        commit_queue=commit_queue,
                        credentials=credentials,
                        ignore_file=args.ignore_file,
                        hard_ignore=args.hard_ignore)
    except KeyError as error:
        sys.stderr.write(
            "Can't clone reference origin/%s from remote %s: %s\n" %
            (args.branch, args.remote_url, error))
        raise error

    # register all the routes
    routes = prepare_routes(args)
    router.register(routes)

    # setup workers
    merge_worker = SyncWorker(args.commiter_name,
                              args.commiter_email,
                              args.commiter_name,
                              args.commiter_email,
                              commit_queue=commit_queue,
                              repository=router.repo,
                              upstream="origin",
                              branch=args.branch,
                              repo_path=router.repo_path,
                              timeout=args.merge_timeout,
                              credentials=credentials,
                              min_idle_times=args.min_idle_times)

    fetch_worker = FetchWorker(upstream="origin",
                               branch=args.branch,
                               repository=router.repo,
                               timeout=args.fetch_timeout,
                               credentials=credentials,
                               idle_timeout=args.idle_fetch_timeout)

    merge_worker.daemon = True
    fetch_worker.daemon = True

    router.workers = [merge_worker, fetch_worker]

    return merge_worker, fetch_worker, router
예제 #2
0
파일: mounter.py 프로젝트: PressLabs/gitfs
def prepare_components(args):
    commit_queue = CommitQueue()

    credentials = get_credentials(args)

    try:
        # setting router
        router = Router(remote_url=args.remote_url,
                        mount_path=args.mount_point,
                        current_path=args.current_path,
                        history_path=args.history_path,
                        repo_path=args.repo_path,
                        branch=args.branch,
                        user=args.user,
                        group=args.group,
                        max_size=args.max_size * 1024 * 1024,
                        max_offset=args.max_size * 1024 * 1024,
                        commit_queue=commit_queue,
                        credentials=credentials,
                        ignore_file=args.ignore_file,
                        hard_ignore=args.hard_ignore)
    except KeyError as error:
        sys.stderr.write("Can't clone reference origin/%s from remote %s: %s\n" %
                         (args.branch, args.remote_url, error))
        raise error

    # register all the routes
    routes = prepare_routes(args)
    router.register(routes)

    # setup workers
    merge_worker = SyncWorker(args.commiter_name, args.commiter_email,
                              args.commiter_name, args.commiter_email,
                              commit_queue=commit_queue,
                              repository=router.repo,
                              upstream="origin",
                              branch=args.branch,
                              repo_path=router.repo_path,
                              timeout=args.merge_timeout,
                              credentials=credentials,
                              min_idle_times=args.min_idle_times)

    fetch_worker = FetchWorker(upstream="origin",
                               branch=args.branch,
                               repository=router.repo,
                               timeout=args.fetch_timeout,
                               credentials=credentials,
                               idle_timeout=args.idle_fetch_timeout)

    merge_worker.daemon = True
    fetch_worker.daemon = True

    router.workers = [merge_worker, fetch_worker]

    return merge_worker, fetch_worker, router
예제 #3
0
def prepare_components(args):
    commit_queue = CommitQueue()

    credentials = get_credentials(args)

    # setting router
    router = Router(remote_url=args.remote_url,
                    mount_path=args.mount_point,
                    repo_path=args.repo_path,
                    branch=args.branch,
                    user=args.user,
                    group=args.group,
                    max_size=args.max_size * 1024 * 1024,
                    max_offset=args.max_size * 1024 * 1024,
                    commit_queue=commit_queue,
                    credentials=credentials,
                    ignore_file=args.ignore_file,
                    hard_ignore=args.hard_ignore)

    # register all the routes
    router.register(routes)

    # setup workers
    merge_worker = SyncWorker(args.commiter_name,
                              args.commiter_email,
                              args.commiter_name,
                              args.commiter_email,
                              commit_queue=commit_queue,
                              repository=router.repo,
                              upstream="origin",
                              branch=args.branch,
                              repo_path=router.repo_path,
                              timeout=args.merge_timeout,
                              credentials=credentials,
                              min_idle_times=args.min_idle_times)

    fetch_worker = FetchWorker(upstream="origin",
                               branch=args.branch,
                               repository=router.repo,
                               timeout=args.fetch_timeout,
                               credentials=credentials,
                               idle_timeout=args.idle_fetch_timeout)

    merge_worker.daemon = True
    fetch_worker.daemon = True

    router.workers = [merge_worker, fetch_worker]

    return merge_worker, fetch_worker, router
예제 #4
0
파일: mounter.py 프로젝트: HWL-RobAt/gitfs
def prepare_components(args):
    commit_queue = CommitQueue()

    credentials = get_credentials(args)

    # setting router
    router = Router(remote_url=args.remote_url,
                    mount_path=args.mount_point,
                    repo_path=args.repo_path,
                    branch=args.branch,
                    user=args.user,
                    group=args.group,
                    max_size=args.max_size * 1024 * 1024,
                    max_offset=args.max_size * 1024 * 1024,
                    commit_queue=commit_queue,
                    credentials=credentials,
                    ignore_file=args.ignore_file,
                    hard_ignore=args.hard_ignore)

    # register all the routes
    router.register(routes)

    # setup workers
    merge_worker = SyncWorker(args.commiter_name, args.commiter_email,
                              args.commiter_name, args.commiter_email,
                              commit_queue=commit_queue,
                              repository=router.repo,
                              upstream="origin",
                              branch=args.branch,
                              repo_path=router.repo_path,
                              timeout=args.merge_timeout,
                              credentials=credentials,
                              min_idle_times=args.min_idle_times)

    fetch_worker = FetchWorker(upstream="origin",
                               branch=args.branch,
                               repository=router.repo,
                               timeout=args.fetch_timeout,
                               credentials=credentials,
                               idle_timeout=args.idle_fetch_timeout)

    merge_worker.daemon = True
    fetch_worker.daemon = True

    router.workers = [merge_worker, fetch_worker]

    return merge_worker, fetch_worker, router
예제 #5
0
파일: mounter.py 프로젝트: odony/gitfs
def prepare_components(args):
    commit_queue = CommitQueue()

    credentials = get_credentials(args)

    try:
        # setting router
        router = Router(remote_url=args.remote_url,
                        mount_path=args.mount_point,
                        current_path=args.current_path,
                        history_path=args.history_path,
                        repo_path=args.repo_path,
                        branch=args.branch,
                        user=args.user,
                        group=args.group,
                        max_size=args.max_size * 1024 * 1024,
                        max_offset=args.max_size * 1024 * 1024,
                        commit_queue=commit_queue,
                        credentials=credentials,
                        ignore_file=args.ignore_file,
                        hard_ignore=args.hard_ignore)
    except KeyError as error:
        sys.stderr.write(
            "Can't clone reference origin/%s from remote %s: %s\n" %
            (args.branch, args.remote_url, error))
        raise error

    # register all the routes
    routes = prepare_routes(args)
    router.register(routes)

    # determine global git user/email if not set (default is to use hostname)
    if ('@%s' % socket.gethostname()
        ) in args.commiter_email and router.repo.default_signature:
        sig = router.repo.default_signature
        args.commiter_email = sig.email
        args.commiter_name = sig.name
        log.info('Using default signature: %s <%s>', sig.name, sig.email)

    # setup workers
    merge_worker = SyncWorker(args.commiter_name,
                              args.commiter_email,
                              args.commiter_name,
                              args.commiter_email,
                              commit_queue=commit_queue,
                              repository=router.repo,
                              upstream="origin",
                              branch=args.branch,
                              repo_path=router.repo_path,
                              timeout=args.merge_timeout,
                              credentials=credentials,
                              min_idle_times=args.min_idle_times)

    fetch_worker = FetchWorker(upstream="origin",
                               branch=args.branch,
                               repository=router.repo,
                               timeout=args.fetch_timeout,
                               credentials=credentials,
                               idle_timeout=args.idle_fetch_timeout)

    merge_worker.daemon = True
    fetch_worker.daemon = True

    router.workers = [merge_worker, fetch_worker]

    return merge_worker, fetch_worker, router