# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from . import mercurial_operations_pb2 as mercurial__operations__pb2


class MercurialOperationsServiceStub(object):
    """Missing associated documentation comment in .proto file."""

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.MergeAnalysis = channel.unary_unary(
                '/hgitaly.MercurialOperationsService/MergeAnalysis',
                request_serializer=mercurial__operations__pb2.MergeAnalysisRequest.SerializeToString,
                response_deserializer=mercurial__operations__pb2.MergeAnalysisResponse.FromString,
                )
        self.PublishChangeset = channel.unary_unary(
                '/hgitaly.MercurialOperationsService/PublishChangeset',
                request_serializer=mercurial__operations__pb2.PublishChangesetRequest.SerializeToString,
                response_deserializer=mercurial__operations__pb2.PublishChangesetResponse.FromString,
                )
        self.Censor = channel.unary_unary(
                '/hgitaly.MercurialOperationsService/Censor',
                request_serializer=mercurial__operations__pb2.CensorRequest.SerializeToString,
                response_deserializer=mercurial__operations__pb2.CensorResponse.FromString,
                )
        self.MergeBranch = channel.unary_unary(
                '/hgitaly.MercurialOperationsService/MergeBranch',
                request_serializer=mercurial__operations__pb2.MergeBranchRequest.SerializeToString,
                response_deserializer=mercurial__operations__pb2.MergeBranchResponse.FromString,
                )


class MercurialOperationsServiceServicer(object):
    """Missing associated documentation comment in .proto file."""

    def MergeAnalysis(self, request, context):
        """Provide all information for a possible merge

        Will be used in mergeability checks and last-minute checks if needed.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def PublishChangeset(self, request, context):
        """Publish a changeset

        As any publication in Mercurial, it also publishes all ancestors that
        were not already public.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Censor(self, request, context):
        """Censor a changeset

        Equivalent of `hg censor`
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def MergeBranch(self, request, context):
        """MergeBranch plays the same role as OperationService.UsermergeBranch with the following differences:

        - It is not a 2-phase operation, hence not streaming
        - The Request message has a slighly different set of options
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_MercurialOperationsServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'MergeAnalysis': grpc.unary_unary_rpc_method_handler(
                    servicer.MergeAnalysis,
                    request_deserializer=mercurial__operations__pb2.MergeAnalysisRequest.FromString,
                    response_serializer=mercurial__operations__pb2.MergeAnalysisResponse.SerializeToString,
            ),
            'PublishChangeset': grpc.unary_unary_rpc_method_handler(
                    servicer.PublishChangeset,
                    request_deserializer=mercurial__operations__pb2.PublishChangesetRequest.FromString,
                    response_serializer=mercurial__operations__pb2.PublishChangesetResponse.SerializeToString,
            ),
            'Censor': grpc.unary_unary_rpc_method_handler(
                    servicer.Censor,
                    request_deserializer=mercurial__operations__pb2.CensorRequest.FromString,
                    response_serializer=mercurial__operations__pb2.CensorResponse.SerializeToString,
            ),
            'MergeBranch': grpc.unary_unary_rpc_method_handler(
                    servicer.MergeBranch,
                    request_deserializer=mercurial__operations__pb2.MergeBranchRequest.FromString,
                    response_serializer=mercurial__operations__pb2.MergeBranchResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'hgitaly.MercurialOperationsService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class MercurialOperationsService(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def MergeAnalysis(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/hgitaly.MercurialOperationsService/MergeAnalysis',
            mercurial__operations__pb2.MergeAnalysisRequest.SerializeToString,
            mercurial__operations__pb2.MergeAnalysisResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def PublishChangeset(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/hgitaly.MercurialOperationsService/PublishChangeset',
            mercurial__operations__pb2.PublishChangesetRequest.SerializeToString,
            mercurial__operations__pb2.PublishChangesetResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Censor(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/hgitaly.MercurialOperationsService/Censor',
            mercurial__operations__pb2.CensorRequest.SerializeToString,
            mercurial__operations__pb2.CensorResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def MergeBranch(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/hgitaly.MercurialOperationsService/MergeBranch',
            mercurial__operations__pb2.MergeBranchRequest.SerializeToString,
            mercurial__operations__pb2.MergeBranchResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
