acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
patch.py (2202B)
1 #!/usr/bin/env python3 2 3 # Applies a commit or commits on branch or branches 4 # USAGE: 5 # patch.py -c <commit-list> -b <branch-list> [-p] [-t] 6 # - <commit-list>: list of commit SHAs to apply. 7 # - <branch-list>: branches where the commit should be applied. * can be used as wildchar 8 # - p: push the changes to <branch-list> 9 # - t: increment version number and create a tag 10 11 12 import os, subprocess, com, re 13 14 push = False 15 16 def clone(repo): 17 com.cmd("git clone --recurse-submodules https://github.com/lvgl/" + repo) 18 os.chdir("./" + repo) 19 com.cmd("git checkout master") 20 com.cmd("git remote update origin --prune") 21 com.cmd("git pull origin --tags") 22 os.chdir("..") 23 24 # Get the list of related minor version branches 25 26 #clone("lvgl") 27 os.chdir("lvgl") 28 29 cmd = "git branch --remotes | grep origin/release/v8" 30 branches, error = subprocess.Popen(cmd, shell=True, executable="/bin/bash", stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() 31 32 branches = str(branches) 33 branches = branches.replace("b'", "") 34 branches = branches.replace("'", "") 35 branches = branches.replace("origin/", "") 36 branches = branches.replace(" ", " ") 37 branches = branches.replace("\\n", "") 38 branches = branches.split(" ") 39 branches = list(filter(len, branches)) 40 41 commits = [] 42 with open('../commits.txt') as f: 43 for line in f: 44 commits.insert(0, line) 45 46 print(commits) 47 48 for br in branches: 49 com.cmd("git checkout " + br) 50 51 print("Applying commits") 52 for c in commits: 53 h = c.split(" ") 54 com.cmd("git cherry-pick " + h[0]) 55 56 ver = com.get_lvgl_version(br) 57 ver_new = ver.copy() 58 ver_new[2] = str(int(ver_new[2]) + 1) 59 print("Updating branch '" + br + "' from '" + com.ver_format(ver) + "' to '" + com.ver_format(ver_new) + "'") 60 com.update_version(ver_new) 61 com.cmd("git tag -a " + com.ver_format(ver_new) + "-m \"Release " + com.ver_format(ver_new) + "\"") 62 63 if push: 64 com.cmd("git push origin " + br + "--tags") 65 66 com.cmd("git checkout master") 67 ver = com.get_lvgl_version("master") 68 ver = com.get_lvgl_version(br) 69 ver_new[2] = str(int(ver_new[2]) + 1) 70 t = com.ver_format(ver_new) + "-dev" 71 com.cmd("git tag -a " + t + " -m \"Start " + t + "\"") 72 73 if push: 74 com.cmd("git push origin master --tags")