Created
May 24, 2026 13:15
-
-
Save liamHowatt/fcbea951ee93172fd3d8a1b8e029b00c to your computer and use it in GitHub Desktop.
git checkout the oldest nuttx-apps commit that is no younger than the checked out nuttx commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| def extract_commit(log): | |
| return log[7:7+40] | |
| def extract_date(log): | |
| return log.splitlines()[4].split("CommitDate:")[1].strip() | |
| outp = subprocess.check_output("git log -1 --pretty=fuller", shell=True).decode() | |
| commit = extract_commit(outp) | |
| date = extract_date(outp) | |
| print(f'This nuttx commit ({commit}) dated "{date}"') | |
| outp = subprocess.check_output(f'git -C ../apps log -1 --pretty=fuller --until="{date}" upstream/master', shell=True).decode() | |
| commit = extract_commit(outp) | |
| date = extract_date(outp) | |
| print(f'will use this apps commit ({commit}) dated "{date}"') | |
| subprocess.check_call(f"git -C ../apps checkout {commit}", shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment