#NEWLINE# @ webapi_check_login_required #NEWLINE# @ webapi_check_local_site #NEWLINE# def get( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# "Returns the information or contents on a per-file diff.\n\n        The output varies by mimetype.\n\n        If :mimetype:`application/json` or :mimetype:`application/xml` is\n        used, then the fields for the diff are returned, like with any other\n        resource.\n\n        If :mimetype:`text/x-patch` is used, then the actual diff file itself\n        is returned. This diff should be as it was when uploaded originally,\n        for this file only, with potentially some extra SCM-specific headers\n        stripped.\n\n        If :mimetype:`application/vnd.reviewboard.org.diff.data+json` or\n        :mimetype:`application/vnd.reviewboard.org.diff.data+xml` is used,\n        then the raw diff data (lists of inserts, deletes, replaces, moves,\n        header information, etc.) is returned in either JSON or XML. This\n        contains nearly all of the information used to render the diff in\n        the diff viewer, and can be useful for building a diff viewer that\n        interfaces with Review Board.\n\n        If ``?syntax-highlighting=1`` is passed, the rendered diff content\n        for each line will contain HTML markup showing syntax highlighting.\n        Otherwise, the content will be in plain text.\n\n        The format of the diff data is a bit complex. The data is stored\n        under a top-level ``diff_data`` element and contains the following\n        information:\n\n        .. list-table::\n           :header-rows: 1\n           :widths: 10 15 75\n\n           * - Field\n             - Type\n             - Description\n\n           * - **binary**\n             - Boolean\n             - Whether or not the file is a binary file. Binary files\n               won't have any diff content to display.\n\n           * - **chunks**\n             - List of Dictionary\n             - A list of chunks. These are used to render the diff. See below.\n\n           * - **changed_chunk_indexes**\n             - List of Integer\n             - The list of chunks in the diff that have actual changes\n               (inserts, deletes, or replaces).\n\n           * - **new_file**\n             - Boolean\n             - Whether or not this is a newly added file, rather than an\n               existing file in the repository.\n\n           * - **num_changes**\n             - Integer\n             - The number of changes made in this file (chunks of adds,\n               removes, or deletes).\n\n        Each chunk contains the following fields:\n\n        .. list-table::\n           :header-rows: 1\n           :widths: 10 15 75\n\n           * - Field\n             - Type\n             - Description\n\n           * - **change**\n             - One of ``equal``, ``delete``, ``insert``, ``replace``\n             - The type of change on this chunk. The type influences what\n               sort of information is available for the chunk.\n\n           * - **collapsable**\n             - Boolean\n             - Whether or not this chunk is collapseable. A collapseable chunk\n               is one that is hidden by default in the diff viewer, but can\n               be expanded. These will always be ``equal`` chunks, but not\n               every ``equal`` chunk is necessarily collapseable (as they\n               may be there to provide surrounding context for the changes).\n\n           * - **index**\n             - Integer\n             - The index of the chunk. This is 0-based.\n\n           * - **lines**\n             - List of List\n             - The list of rendered lines for a side-by-side diff. Each\n               entry in the list is itself a list with 8 items:\n\n               1. Row number of the line in the combined side-by-side diff.\n               2. The line number of the line in the left-hand file, as an\n                  integer (for ``replace``, ``delete``, and ``equal`` chunks)\n                  or an empty string (for ``insert``).\n               3. The text for the line in the left-hand file.\n               4. The indexes within the text for the left-hand file that\n                  have been replaced by text in the right-hand side. Each\n                  index is a list of ``start, end`` positions, 0-based.\n                  This is only available for ``replace`` lines. Otherwise the\n                  list is empty.\n               5. The line number of the line in the right-hand file, as an\n                  integer (for ``replace``, ``insert`` and ``equal`` chunks)\n                  or an empty string (for ``delete``).\n               6. The text for the line in the right-hand file.\n               7. The indexes within the text for the right-hand file that\n                  are replacements for text in the left-hand file. Each\n                  index is a list of ``start, end`` positions, 0-based.\n                  This is only available for ``replace`` lines. Otherwise the\n                  list is empty.\n               8. A boolean that indicates if the line contains only\n                  whitespace changes.\n\n           * - **meta**\n             - Dictionary\n             - Additional information about the chunk. See below for more\n               information.\n\n           * - **numlines**\n             - Integer\n             - The number of lines in the chunk.\n\n        A chunk's meta information contains:\n\n        .. list-table::\n           :header-rows: 1\n           :widths: 25 15 60\n\n           * - Field\n             - Type\n             - Description\n\n           * - **headers**\n             - List of (String, String)\n             - Class definitions, function definitions, or other useful\n               headers that should be displayed before this chunk. This helps\n               users to identify where in a file they are and what the current\n               chunk may be a part of.\n\n           * - **whitespace_chunk**\n             - Boolean\n             - Whether or not the entire chunk consists only of whitespace\n               changes.\n\n           * - **whitespace_lines**\n             - List of (Integer, Integer)\n             - A list of ``start, end`` row indexes in the lins that contain\n               whitespace-only changes. These are 1-based.\n\n        Other meta information may be available, but most is intended for\n        internal use and shouldn't be relied upon.\n        " #NEWLINE# mimetype = get_http_requested_mimetype ( request , [ mimetype [ 'item' ] for mimetype in self . allowed_mimetypes ] ) #NEWLINE# if ( mimetype == 'text/x-patch' ) : #NEWLINE# #INDENT# return self . _get_patch ( request , * args , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if mimetype . startswith ( ( self . DIFF_DATA_MIMETYPE_BASE + '+' ) ) : #NEWLINE# #INDENT# return self . _get_diff_data ( request , mimetype , * args , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return super ( FileDiffResource , self ) . get ( request , * args , ** kwargs )