Compare commits
7 Commits
7e50ac4f06
...
31b91e2a1c
Author | SHA1 | Date |
---|---|---|
Brett | 31b91e2a1c | |
Brett | 5a541c50c4 | |
Brett | dd92b2bbcc | |
Brett | 89c98c5196 | |
Brett | 6992be4e56 | |
Brett | de0c52cfe0 | |
Brett | a069e33c59 |
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(COSC-4P80-Assignment-1 VERSION 13.6.0)
|
project(COSC-4P80-Assignment-1 VERSION 14.2.0)
|
||||||
|
|
||||||
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
||||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||||
|
|
43
commit.py
43
commit.py
|
@ -56,6 +56,8 @@ class Config:
|
||||||
j = json.load(f)
|
j = json.load(f)
|
||||||
obj = Config()
|
obj = Config()
|
||||||
[setattr(obj, key, val) for key, val in j.items() if hasattr(obj, key)]
|
[setattr(obj, key, val) for key, val in j.items() if hasattr(obj, key)]
|
||||||
|
if obj.branch_on_minor:
|
||||||
|
obj.branch_on_major = True
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
def from_file(file):
|
def from_file(file):
|
||||||
|
@ -170,6 +172,12 @@ def make_branch(config: Config, name):
|
||||||
subprocess.call(["git", "merge", config.main_branch])
|
subprocess.call(["git", "merge", config.main_branch])
|
||||||
subprocess.call(["git", "checkout", config.main_branch])
|
subprocess.call(["git", "checkout", config.main_branch])
|
||||||
|
|
||||||
|
def sync_branch(config: Config, version_parts, args):
|
||||||
|
if config.branch_on_major:
|
||||||
|
# Branch will be created.
|
||||||
|
if args.minor:
|
||||||
|
return;
|
||||||
|
|
||||||
def make_release(env: EnvData, name):
|
def make_release(env: EnvData, name):
|
||||||
print(f"Making new release {name}")
|
print(f"Making new release {name}")
|
||||||
repos_v = open_process(["git", "remote", "-v"])[0].splitlines()
|
repos_v = open_process(["git", "remote", "-v"])[0].splitlines()
|
||||||
|
@ -269,20 +277,39 @@ def main():
|
||||||
|
|
||||||
cmake_text = load_cmake()
|
cmake_text = load_cmake()
|
||||||
version_parts = split_version(cmake_text)[0]
|
version_parts = split_version(cmake_text)[0]
|
||||||
if not args.no_branch and args.major:
|
if args.major:
|
||||||
if config.branch_on_major:
|
if config.branch_on_major:
|
||||||
make_branch(config, "v" + str(version_parts[0]))
|
if not args.no_branch:
|
||||||
if not args.no_branch and args.minor:
|
make_branch(config, "v" + str(version_parts[0]))
|
||||||
|
|
||||||
|
if args.minor:
|
||||||
if config.branch_on_minor:
|
if config.branch_on_minor:
|
||||||
make_branch(config, "v" + str(version_parts[0]) + "." + str(version_parts[1]))
|
if not args.no_branch:
|
||||||
|
make_branch(config, "v" + str(version_parts[0]) + "." + str(version_parts[1]))
|
||||||
|
elif config.branch_on_major:
|
||||||
|
subprocess.call(["git", "checkout", "v" + str(version_parts[0])])
|
||||||
|
subprocess.call(["git", "rebase", config.main_branch])
|
||||||
|
subprocess.call(["git", "checkout", config.main_branch])
|
||||||
|
|
||||||
|
if args.patch:
|
||||||
|
if config.branch_on_minor:
|
||||||
|
subprocess.call(["git", "checkout", "v" + str(version_parts[0]) + "." + str(version_parts[1])])
|
||||||
|
subprocess.call(["git", "rebase", config.main_branch])
|
||||||
|
subprocess.call(["git", "checkout", config.main_branch])
|
||||||
|
elif config.branch_on_major:
|
||||||
|
subprocess.call(["git", "checkout", "v" + str(version_parts[0])])
|
||||||
|
subprocess.call(["git", "rebase", config.main_branch])
|
||||||
|
subprocess.call(["git", "checkout", config.main_branch])
|
||||||
|
|
||||||
|
sync_branch(config=config, version_parts=version_parts, args=args)
|
||||||
|
|
||||||
subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"])
|
subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"])
|
||||||
|
|
||||||
if not args.no_release and args.major:
|
if args.major:
|
||||||
if config.release_on_major:
|
if not args.no_release and config.release_on_major:
|
||||||
make_release(env, "v" + str(version_parts[0]))
|
make_release(env, "v" + str(version_parts[0]))
|
||||||
if not args.no_release and args.minor:
|
if args.minor:
|
||||||
if config.release_on_minor:
|
if not args.no_release and config.release_on_minor:
|
||||||
make_release(env, "v" + str(version_parts[0]) + "." + str(version_parts[1]))
|
make_release(env, "v" + str(version_parts[0]) + "." + str(version_parts[1]))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue