code: def update_ref(self, new_ref_info, repository_id, filter, project=None, project_id=None):
          
          route_values = {}
          if project is not None:
              route_values['project'] = self._serialize.url('project', project, 'str')
          if repository_id is not None:
              route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
          query_parameters = {}
          if filter is not None:
              query_parameters['filter'] = self._serialize.query('filter', filter, 'str')
          if project_id is not None:
              query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
          content = self._serialize.body(new_ref_info, 'GitRefUpdate')
          response = self._send(http_method='PATCH',
                                location_id='2d874a60-a811-4f62-9c9f-963a6ea0a55b',
                                version='5.1-preview.1',
                                route_values=route_values,
                                query_parameters=query_parameters,
                                content=content)
          return self._deserialize('GitRef', response)
docs: UpdateRef.
          [Preview API] Lock or Unlock a branch.
          :param :class:`<GitRefUpdate> <azure.devops.v5_1.git.models.GitRefUpdate>` new_ref_info: The ref update action (lock/unlock) to perform
          :param str repository_id: The name or ID of the repository.
          :param str filter: The name of the branch to lock/unlock
          :param str project: Project ID or project name
          :param str project_id: ID or name of the team project. Optional if specifying an ID for repository.
          :rtype: :class:`<GitRef> <azure.devops.v5_1.git.models.GitRef>`