       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0
  ?   ˆl–Ðz¾”Šj"Tâ‚À½q¶”Å£�þZhk8ÙHÜn†G¥xÏÂƒ{Á_ˆI|¥�+y,ÁÀ      ˆÄ‘äÇò 8à_nWÛq�>ÏóÃƒh¹ÂÁÀ J    #ifndef Py_EXPORTS_H
#define Py_EXPORTS_H

#if defined(_WIN32) || defined(__CYGWIN__)
    #define Py_IMPORTED_SYMBOL __declspec(dllimport)
    #define Py_EXPORTED_SYMBOL __declspec(dllexport)
    #define Py_LOCAL_SYMBOL
#else
/*
 * If we only ever used gcc >= 5, we could use __has_attribute(visibility)
 * as a cross-platform way to determine if visibility is supported. However,
 * we may still need to support gcc >= 4, as some Ubuntu LTS and Centos versions
 * have 4 < gcc < 5.
 */
    #ifndef __has_attribute
      #define __has_attribute(x) 0  // Compatibility with non-clang compilers.
    #endif
    #if (defined(__GNUC__) && (__GNUC__ >= 4)) ||\
        (defined(__clang__) && __has_attribute(visibility))
        #define Py_IMPORTED_SYMBOL __attribute__ ((visibility ("default")))
        #define Py_EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
        #define Py_LOCAL_SYMBOL  __attribute__ ((visibility ("hidden")))
    #else
        #define Py_IMPORTED_SYMBOL
        #define Py_EXPORTED_SYMBOL
        #define Py_LOCAL_SYMBOL
    #endif
#endif

#endif /* Py_EXPORTS_H */
             0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0
      ˆÄ‘äÇò 8à_nWÛqâ¶×óÃƒh¹ÂÁÀ             0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0
      	ˆÄ‘äÇò 8à_nWÛt®ÏçÃƒh¹ÂÁÀ      	0
      ˆÄ‘äÇò 8à_nWÛ}©ùÃƒh¹ÂÁÀ      0
      ˆÄ‘äÇò 8à_nWÛmHOçÃƒh¹ÂÁÀ      [none] mq-deadline 
  B   ˆl–äY>”JeJe@†à¸Û*bÑ¿�þDR²³r…Â² ’FšóÄ„€Ã_ŠI|¥�+Wé3ž¯ÃÂ .ã    # wireprotolfsserver.py - lfs protocol server side implementation
#
# Copyright 2018 Matt Harbison <matt_harbison@yahoo.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.


import datetime
import errno
import json
import traceback

from mercurial.hgweb import common as hgwebcommon

from mercurial import (
    exthelper,
    pycompat,
    util,
    wireprotoserver,
)

from . import blobstore

HTTP_OK = hgwebcommon.HTTP_OK
HTTP_CREATED = hgwebcommon.HTTP_CREATED
HTTP_BAD_REQUEST = hgwebcommon.HTTP_BAD_REQUEST
HTTP_NOT_FOUND = hgwebcommon.HTTP_NOT_FOUND
HTTP_METHOD_NOT_ALLOWED = hgwebcommon.HTTP_METHOD_NOT_ALLOWED
HTTP_NOT_ACCEPTABLE = hgwebcommon.HTTP_NOT_ACCEPTABLE
HTTP_UNSUPPORTED_MEDIA_TYPE = hgwebcommon.HTTP_UNSUPPORTED_MEDIA_TYPE

eh = exthelper.exthelper()


@eh.wrapfunction(wireprotoserver, b'handlewsgirequest')
def handlewsgirequest(orig, rctx, req, res, checkperm):
    """Wrap wireprotoserver.handlewsgirequest() to possibly process an LFS
    request if it is left unprocessed by the wrapped method.
    """
    if orig(rctx, req, res, checkperm):
        return True

    if not rctx.repo.ui.configbool(b'experimental', b'lfs.serve'):
        return False

    if not util.safehasattr(rctx.repo.svfs, 'lfslocalblobstore'):
        return False

    if not req.dispatchpath:
        return False

    try:
        if req.dispatchpath == b'.git/info/lfs/objects/batch':
            checkperm(rctx, req, b'pull')
            return _processbatchrequest(rctx.repo, req, res)
        # TODO: reserve and use a path in the proposed http wireprotocol /api/
        #       namespace?
        elif req.dispatchpath.startswith(b'.hg/lfs/objects'):
            return _processbasictransfer(
                rctx.repo, req, res, lambda perm: checkperm(rctx, req, perm)
            )
        return False
    except hgwebcommon.ErrorResponse as e:
        # XXX: copied from the handler surrounding wireprotoserver._callhttp()
        #      in the wrapped function.  Should this be moved back to hg