import os
import sys
from os import path
repolist = "../.repo/repo/repo list > list.txt"
desPatch = "patch"
if not os.path.exists(desPatch):
os.mkdir(desPatch)
def exportDiff():
lists = os.system(repolist)
if lists == 0:
d = os.path.dirname(os.getcwd())
for project in open("list.txt"):
projectPath = project.split(":")[0].strip()
src = "cd " + os.path.join(d, projectPath)
# os.system(src)
diffname = projectPath.replace("/", "_") + ".patch"
diffcmd = "git diff >" + os.path.join(d, "patch_test", desPatch, diffname)
print(diffcmd)
os.system(src + " && " + diffcmd + " && cd -")
elif False:
d = os.path.dirname(os.getcwd())
for project in open("list.txt"):
projectPath = project.split(":")[0].strip()
remoteName = project.split(":")[1].strip()
src = "cd " + os.path.join(d, projectPath)
diffname = projectPath.replace("/", "_") + ".patch"
diffcmd = "git diff >" + os.path.join(d, "patch_test", desPatch, diffname)
print(diffcmd)
os.system(src + " && " + "git pull " + remoteName + " && cd -")
print("pull cmd exe end")
def apllyDiff():
for project in open("list.txt"):
projectPath = project.split(":")[0].strip()
src = "cd " + os.path.join(d, projectPath)
# os.system(src)
diffname = projectPath.replace("/", "_") + ".patch"
diffcmd = "git apply >" + os.path.join(d, "patch_test", desPatch, diffname)
print(diffcmd)
os.system(src + " && " + diffcmd + " && cd -")
def test():
d = os.path.dirname(os.getcwd())
for project in open("list.txt"):
projectPath = project.split(":")[0].strip()
os.chdir(os.path.join(d, projectPath))
diffname = projectPath.replace("/", "_") + ".patch"
diffcmd = "git apply >" + os.path.join(d, "patch_test", desPatch, diffname)
diffpull = "git pull"
print(os.getcwd())
os.system(diffpull)
# find . -name "*" -type f -size 0c | xargs -n 1 rm -f
if __name__ == '__main__':
if len(sys.argv) != 2:
print("please add action apply or exp")
else:
arg = sys.argv[1]
print(arg)
if arg=="apply":
apllyDiff()
elif arg=="exp":
exportDiff()
elif arg=="1":
test()
else:
print("use apply or exp")
收集aosp改动
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 1.Notification(通知) 自从Notification被引入之后,苹果就不断的更新优化,但这些更新优化...
- 收集.方法|收音.文字以外的收集.手机收集(四)2019.04.05 录音,在这个APP多如牛毛的时代,已经不难找...
- 怎么查看服务器默认的垃圾收集器是那个?(+UseParallelGC) 命令: java -XX:+PrintCo...
- 收集.方法|从今天起,当一只有收集癖的松鼠.手机收集.前传2019.04.01 当一个话痨打开一扇窗,你以为这间屋...