def merge_file(self, kitchen, recipe, file_path, file_contents, orig_head, last_file_sha):
        """
        Returns the result of merging a local file with the latest version on the remote.
        This does not cause any side-effects on the server, and no actual merge is performed in the remote repo.
        /v2/file/merge/<string:kitchenname>/<string:recipename>/<path:filepath>, methods=['POST']
        :param kitchen: name of the kitchen where this file lives
        :param recipe: name of the recipe that owns this file
        :param file_path: path to the file, relative to the recipe
        :param file_contents: contents of the file
        :param orig_head: sha of commit head of the branch when this file was obtained.
        :param last_file_sha: The sha of the file when it was obtained from the server.
        :return: dict
        """
        rc = DKReturnCode()
        if kitchen is None or isinstance(kitchen, basestring) is False or \
                recipe is None or isinstance(recipe, basestring) is False or \
                file_path is None or isinstance(file_path, basestring) is False or \
                orig_head is None or isinstance(orig_head, basestring) is False or \
                last_file_sha is None or isinstance(last_file_sha, basestring) is False or \
                file_contents is None:
            rc.set(rc.DK_FAIL, 'One or more parameters is invalid. ')
            return rc

        params = dict()
        params['orig_head'] = orig_head
        params['last_file_sha'] = last_file_sha
        params['content'] = file_contents
        adjusted_file_path = file_path
        url = '%s/v2/file/merge/%s/%s/%s' % (self.get_url_for_direct_rest_call(), kitchen, recipe, adjusted_file_path)
        try:
            response = requests.post(url, data=json.dumps(params), headers=self._get_common_headers())
            rdict = self._get_json(response)
        except (RequestException, ValueError, TypeError), c:
            print "merge_file: exception: %s" % str(c)
            return None
        if DKCloudAPI._valid_response(response) is True and rdict is not None and isinstance(rdict, dict) is True:
            rc.set(rc.DK_SUCCESS, None, rdict)
            return rc
        else:
            rc.set(rc.DK_FAIL, str(rdict))
            return rc
def merge_file ( self , kitchen , recipe , file_path , file_contents , orig_head , last_file_sha ) : rc = DKReturnCode ( ) if kitchen is None or isinstance ( kitchen , basestring ) is False or recipe is None or isinstance ( recipe , basestring ) is False or file_path is None or isinstance ( file_path , basestring ) is False or orig_head is None or isinstance ( orig_head , basestring ) is False or last_file_sha is None or isinstance ( last_file_sha , basestring ) is False or file_contents is None : rc . set ( rc . DK_FAIL , 'One or more parameters is invalid. ' ) return rc params = dict ( ) params [ 'orig_head' ] = orig_head params [ 'last_file_sha' ] = last_file_sha params [ 'content' ] = file_contents adjusted_file_path = file_path url = '%s/v2/file/merge/%s/%s/%s' % ( self . get_url_for_direct_rest_call ( ) , kitchen , recipe , adjusted_file_path ) try : response = requests . post ( url , data = json . dumps ( params ) , headers = self . _get_common_headers ( ) ) rdict = self . _get_json ( response ) except ( RequestException , ValueError , TypeError ) , c : print "merge_file: exception: %s" % str ( c ) return None if DKCloudAPI . _valid_response ( response ) is True and rdict is not None and isinstance ( rdict , dict ) is True : rc . set ( rc . DK_SUCCESS , None , rdict ) return rc else : rc . set ( rc . DK_FAIL , str ( rdict ) ) return rc
Returns the result of merging a local file with the latest version on the remote.
        This does not cause any side-effects on the server, and no actual merge is performed in the remote repo.
        /v2/file/merge/<string:kitchenname>/<string:recipename>/<path:filepath>, methods=['POST']
        :param kitchen: name of the kitchen where this file lives
        :param recipe: name of the recipe that owns this file
        :param file_path: path to the file, relative to the recipe
        :param file_contents: contents of the file
        :param orig_head: sha of commit head of the branch when this file was obtained.
        :param last_file_sha: The sha of the file when it was obtained from the server.
        :return: dict