Skip to content

Commit faed355

Browse files
committed
bundle_libs_tooling: add check_new_changes_in_official
1 parent d4b474e commit faed355

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

external/bindings_generation/bundle_libs_tooling/all_external_libraries.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,19 @@ def fetch_all_submodules():
278278
if lib.is_submodule():
279279
print(lib.name)
280280
lib.cmd_fetch_all().run()
281+
282+
def check_new_changes_in_official():
283+
unchanged = []
284+
changed = []
285+
for lib in ALL_LIBS:
286+
has_changes = lib.has_new_changes_in_official()
287+
if has_changes:
288+
changed.append(lib.name)
289+
else:
290+
unchanged.append(lib.name)
291+
292+
unchanged_str = ", ".join(unchanged)
293+
changed_str = ", ".join(changed)
294+
print(f"Unchanged libraries: {unchanged_str}")
295+
print(f"Libraries with new changes in official repo: {changed_str}")
296+

external/bindings_generation/bundle_libs_tooling/external_library.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,27 @@ def run_pull(self):
207207
)
208208
return
209209
self.cmd_pull().run()
210+
211+
def has_new_changes_in_official(self) -> bool:
212+
import subprocess
213+
214+
if self.fork_git_url is None:
215+
return False
216+
if self.official_branch == self.fork_branch:
217+
return False
218+
219+
has_changes = False
220+
221+
# self.cmd_fetch_all().run()
222+
cur_dir = os.getcwd()
223+
os.chdir(self.git_folder_abs_path())
224+
cmd_str = f"git --no-pager log --oneline {self.fork_branch}..{self.official_branch}"
225+
226+
cmd_result_str: str
227+
process_result = subprocess.run(cmd_str, shell=True, capture_output=True, text=True)
228+
if len(process_result.stdout) > 0:
229+
has_changes = True
230+
231+
os.chdir(cur_dir)
232+
233+
return has_changes

external/bindings_generation/sandbox.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
# all_external_libraries.reattach_all_submodules()
66
# all_external_libraries.pull_all_submodules()
77
# all_external_libraries.fetch_all_submodules()
8+
all_external_libraries.check_new_changes_in_official()
89

9-
cmd = all_external_libraries.lib_implot3d().cmd_rebase_fork_on_official_changes()
10-
print(cmd)
11-
cmd.run()
10+
# cmd = all_external_libraries.lib_implot3d().cmd_rebase_fork_on_official_changes()
11+
# print(cmd)
12+
# cmd.run()
1213

0 commit comments

Comments
 (0)