参考:

https://docs.gitlab.com/ee/api/projects.html

https://python-gitlab.readthedocs.io/en/stable/gl_objects/projects.html#

Project merge method

There are currently three options for merge_method to choose from:

  • merge: A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.

  • rebase_merge: A merge commit is created for every merge, but merging is only allowed if fast-forward merge is possible. This way you could make sure that if this merge request would build, after merging to target branch it would also build.

  • ff: No merge commits are created and all merges are fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.

测试

#!/usr/bin/env python3

import gitlab
import sys
import os
import subprocess
import xml.dom.minidom
from xml.dom.minidom import parse url = "http://192.168.1.100:12345"
token = 'DFnkTaxn9sk382onzEzw' if __name__ == '__main__': gl = gitlab.Gitlab(url, private_token=token)
print("Connect to gitlab url: " + url) project = gl.projects.get("thirdpart/spdk")
print(project)
print(project.merge_method) project.merge_method = 'merge'
project.save()
print("======> set to 'merge'")
project = gl.projects.get("thirdpart/spdk")
print(project.merge_method) project.merge_method = 'ff'
project.save()
print("======> set to 'ff'")
project = gl.projects.get("thirdpart/spdk")
print(project.merge_method) project.merge_method = 'rebase_merge'
project.save()
print("======> set to 'rebase_merge'")
project = gl.projects.get("thirdpart/spdk")
print(project.merge_method) sys.exit(0)

Log

完。

python-gitlab 之更改 merge_method的更多相关文章

  1. python创建目录并更改权限的代码

    如下代码段是关于python创建目录并更改权限的代码. import os os.mkdir("foo", 0666)

  2. python gitlab 学习笔记

    gitlab创建个人访问令牌(personal access token) https://blog.csdn.net/NGU2028070003/article/details/86634474 P ...

  3. 利用 Python 进行批量更改文件后缀

    利用 Python 进行批量更改文件后缀 代码 import os files = os.listdir('.') for file_name in files: portion = os.path. ...

  4. Python练习_更改配置文件(3)

    学习完成第三阶段,我们来写一个功能:也就是实现对配置文件的backend字段进行增删改查 1.查 输入:www.oldboy.org 获取当前backend下的所有记录 2.新建 输入: arg = ...

  5. 加速github、kaggle访问、加速python packge下载更改源

    OS: WIN10 加速github.kaggle访问 使用站长DNS工具(http://tool.chinaz.com/dns) 查询响应速度最快的网站服务器IP,将网站服务器IP和域名添加到电脑h ...

  6. Jenkins+Python+GitLab持续集成

    创建任务 登录Jenkins,点击左侧列表的新建选项.输入任务名称,选择构建一个自由风格的软件项目,点击确定. 配置 在任务配置界面,可以设置General标签中的丢弃旧的构建选项,设置保持构建的天数 ...

  7. Python实现自动更改系统用户密码,生成随机密码

    算是一个实用的例子,定制系统任务,并将随机密码上传至日志服务器,实现定期修改密码: 部分代码: 1 #!/usr/bin/env python 2 #coding:utf-8 3 import ran ...

  8. 【python】windows更改jupyter notebook(ipython)的默认打开工作路径

    写在前面:本博客为本人原创,严禁任何形式的转载!本博客只允许放在博客园(.cnblogs.com),如果您在其他网站看到这篇博文,请通过下面这个唯一的合法链接转到原文! 本博客全网唯一合法URL:ht ...

  9. python的pip更改源,因为我们处于局域网中

    很多时候,比如网络不给力,连接超时.防火墙阻挡等等各种原因,我们可能无法从Python官方的PyPi仓库进行pip安装,这时候可以选择国内的第三方源,推荐使用豆瓣源,速度不错. 使用方法: pip i ...

随机推荐

  1. <每日 1 OJ> -LeetCode20. 有效的括号

    题目: 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效. 有效字符串需满足: 左括号必须用相同类型的右括号闭合.左括号必须以正确的顺序闭合.注意空字符串可 ...

  2. 疯了!同事又问我为什么不能用 isXXX

    最近在做Code Review,写下了这篇文章:代码写成这样,老夫无可奈何!,说多了都是泪啊.. 最近又有人同事跑过来质疑我: 为什么变量名取名不能用 isXXX 这种方式,这样有什么问题?! 醉了, ...

  3. FPGA硬件加速

    FPGA市场占有率最高的两大公司Xilinx和Altera. 查找表(Look-Up-Table)简称为LUT,LUT本质上就是一个RAM.目前FPGA中多使用4输入的LUT,所以每一个LUT可以看成 ...

  4. elasticsearch容量规划

    https://docs.bonsai.io/article/123-capacity-planning Capacity Planning Capacity planning is the proc ...

  5. Azure DevOps Server 2019 第一个补丁包(2019.0.1 RTW)

    在Azure DevOps Server 2019正式发布后的2周左右时间,微软快速发布了第一个补丁包Azure DevOps Server 2019.0.1 RTW.Azure DevOps Ser ...

  6. osx或windows系统下,用ftp上传文件到阿里云虚拟主机脚本

    某天突然发现,一直在用的ftp工具并不好用,操作界面太过繁琐,而且不太稳定.于是自己找资料,整合了几句虽然简单,但是方便的代码. mac脚本 #从本地向FTP批量上传文档 需要赋予该.shell文件权 ...

  7. Excel VBA业余爱好者心得及总结

    我不是IT专业人士,而是一位医务工作者,当初学习Excel VBA时,是因为读研究生时的课题需要:实验仪器每天产生4个Word文件,每个文件有9个表格,总计近百个数据.为了对这些数据进行统计分析,则需 ...

  8. python实现队列结构

    # -*- coding:utf-8 -*- # __author__ :kusy # __content__:文件说明 # __date__:2018/10/8 13:49 class MyQueu ...

  9. oc的运行时系统

    Objective-C is a class-based object system. Each object is an instance of some class; the object's i ...

  10. HTML+CSS+JS综合练习(动态验证版)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...