Skip to content

Commit b8c887d

Browse files
ES-Alexanderpatrickelectric
authored andcommitted
scripts: run_parsers: groundskeeper: ignore dev-controlled files
Stops accidentally skipping output generation when a code or README change was more recent than the last update of a tag.
1 parent ba61a1a commit b8c887d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

scripts/run_parsers.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ def tag_latest_versions(self):
9292
pass # If the tag already exists, we are happy
9393

9494
@staticmethod
95-
def get_last_ground_change(repository: git.Repo):
95+
def get_last_ground_change(repository: git.Repo|None = None):
96+
if repository is None:
97+
# Determine last ground change of the repo of this file
98+
source = git.Git(Path(__file__).parent.parent)
99+
# Ignore irrelevant files, and extract date of latest change in an unambiguous format
100+
last_relevant_commit_date = source.log('-1', '--format=%cI', '--', ':^.github', ':^README.md', ':^scripts')
101+
return datetime.fromisoformat(last_relevant_commit_date)
102+
103+
# Determine last ground change of some other repo
96104
last_commit_date = repository.head.commit.committed_date
97105
return datetime.fromtimestamp(last_commit_date)
98106

@@ -110,7 +118,7 @@ def run(self):
110118
self.repository = self.clone_repository()
111119
self.tag_latest_versions() # Create temporary/local tags, to include development versions in metadata generation
112120
tag_names = [tag.path[len('refs/tags/'):] for tag in self.repository.tags]
113-
last_ground_change = self.get_last_ground_change(git.Repo(Path(__file__).parent.parent))
121+
last_ground_change = self.get_last_ground_change()
114122

115123
# Prepare for MAVLink parsing - always use the latest script (since it might cover new messages)
116124
#shutil.copy(f'{self.repository_path}/Tools/scripts/mavlink_parse.py', self.temp_folder)

0 commit comments

Comments
 (0)