Пример #1
0
def connect(link):
    # Send the announce message - we only support protocol version 2.
    """

    :type link: SvnRequestHandler
    """
    link.send_msg(gen.success(2, 2, gen.list(),
                              gen.list(*server_capabilities)))
    msg = parse.msg(link.read_msg())

    proto_ver = int(msg[0])
    client_caps = msg[1]
    url = parse.string(msg[2])

    print "ver: %d" % proto_ver
    print "caps: %s" % client_caps
    print "url: %s" % url

    if proto_ver != 2:
        raise BadProtoVersion()

    repo, path, base_url = link.server.find_repo(url)

    if repo is None:
        link.send_msg(
            gen.failure(
                gen.list(210005,
                         gen.string("No repository found in '%s'" % url),
                         gen.string('message.py'), 0)))

    return path, client_caps, repo, base_url
Пример #2
0
def connect(link):
    # Send the announce message - we only support protocol version 2.
    """

    :type link: SvnRequestHandler
    """
    link.send_msg(gen.success(2, 2, gen.list(), gen.list(*server_capabilities)))
    msg = parse.msg(link.read_msg())

    proto_ver = int(msg[0])
    client_caps = msg[1]
    url = parse.string(msg[2])

    print "ver: %d" % proto_ver
    print "caps: %s" % client_caps
    print "url: %s" % url

    if proto_ver != 2:
        raise BadProtoVersion()

    repo, path, base_url = link.server.find_repo(url)

    if repo is None:
        link.send_msg(gen.failure(gen.list(210005,
                                           gen.string("No repository found in '%s'" % url),
                                           gen.string('message.py'), 0)))

    return path, client_caps, repo, base_url
Пример #3
0
def process(link):
    msg = parse.msg(link.read_msg())

    command_name = msg[0]
    args = msg[1]

    command = commands.get(command_name, None)

    if command is None:
        link.send_msg(gen.error(210001, "Unknown command '%s'" % command_name))
        return None

    print "found %s" % command_name
    # noinspection PyCallingNonCallable
    return command(link, args)
Пример #4
0
def process(link):
    msg = parse.msg(link.read_msg())

    command = link.command

    if command is None:
        raise ModeError('editor mode requires a current command')

    editor = msg[0]
    args = msg[1]

    if editor not in edit_cmds:
        command.log_edit_error(210001, "Unknown command '%s'" % editor)
        return

    edit_cmds[editor](command, args)
Пример #5
0
def process(link):
    msg = parse.msg(link.read_msg())

    command = link.command

    if command is None:
        raise ModeError('report mode requires a current command')

    report = msg[0]
    args = msg[1]

    if report not in rpt_cmds:
        command.log_report_error(210001, "Unknown command '%s'" % report)
        return

    rpt_cmds[report](command, args)
Пример #6
0
def perform_auth(link, auth_db):
    """


    :type link: SvnRequestHandler
    :rtype : User
    """
    link.send_msg(gen.success(gen.list(*auths.keys()), gen.string(link.base_url)))

    while True:
        auth_type = parse.msg(link.read_msg())[0]

        if auth_type not in auths:
            link.send_msg(gen.failure(gen.string('unknown auth type: %s' % auth_type)))
            continue

        auth = auths[auth_type](link, auth_db)

        user = auth.do_auth()
        if user:
            return user
Пример #7
0
def perform_auth(link, auth_db):
    """


    :type link: SvnRequestHandler
    :rtype : User
    """
    link.send_msg(
        gen.success(gen.list(*auths.keys()), gen.string(link.base_url)))

    while True:
        auth_type = parse.msg(link.read_msg())[0]

        if auth_type not in auths:
            link.send_msg(
                gen.failure(gen.string('unknown auth type: %s' % auth_type)))
            continue

        auth = auths[auth_type](link, auth_db)

        user = auth.do_auth()
        if user:
            return user