Corey Morris
commited on
Commit
•
5d87f13
1
Parent(s):
ff055eb
Updated regression test
Browse files- save_for_regression.py +16 -7
save_for_regression.py
CHANGED
@@ -11,7 +11,7 @@ import os
|
|
11 |
|
12 |
import subprocess
|
13 |
|
14 |
-
def
|
15 |
try:
|
16 |
# Change to the repository directory
|
17 |
original_path = os.getcwd()
|
@@ -23,24 +23,33 @@ def has_uncommitted_changes(repo_path):
|
|
23 |
# Check the result
|
24 |
if result.returncode != 0:
|
25 |
print(f"Error checking git status: {result.stderr}")
|
26 |
-
return False
|
27 |
|
28 |
-
#
|
29 |
-
|
|
|
|
|
|
|
30 |
|
31 |
finally:
|
32 |
# Change back to the original directory
|
33 |
os.chdir(original_path)
|
34 |
|
35 |
if __name__ == '__main__':
|
36 |
-
|
37 |
-
|
|
|
38 |
else:
|
39 |
-
print("There are no
|
40 |
df_current = ResultDataProcessor().data
|
41 |
last_commit = os.popen('git rev-parse HEAD').read().strip()
|
42 |
print(last_commit)
|
43 |
# save the current output to a file
|
44 |
df_current.to_parquet(f'output_{last_commit}.parquet', index=True)
|
45 |
print("Saved output to file")
|
|
|
|
|
|
|
|
|
|
|
46 |
|
|
|
11 |
|
12 |
import subprocess
|
13 |
|
14 |
+
def check_git_changes(repo_path):
|
15 |
try:
|
16 |
# Change to the repository directory
|
17 |
original_path = os.getcwd()
|
|
|
23 |
# Check the result
|
24 |
if result.returncode != 0:
|
25 |
print(f"Error checking git status: {result.stderr}")
|
26 |
+
return False, False
|
27 |
|
28 |
+
# Check for tracked and untracked changes
|
29 |
+
tracked_changes = any(line[:2].strip() != '??' for line in result.stdout.splitlines())
|
30 |
+
untracked_changes = any(line[:2] == '??' for line in result.stdout.splitlines())
|
31 |
+
|
32 |
+
return tracked_changes, untracked_changes
|
33 |
|
34 |
finally:
|
35 |
# Change back to the original directory
|
36 |
os.chdir(original_path)
|
37 |
|
38 |
if __name__ == '__main__':
|
39 |
+
tracked_changes, untracked_changes = check_git_changes('.')
|
40 |
+
if tracked_changes:
|
41 |
+
print("There are tracked changes")
|
42 |
else:
|
43 |
+
print("There are no tracked changes")
|
44 |
df_current = ResultDataProcessor().data
|
45 |
last_commit = os.popen('git rev-parse HEAD').read().strip()
|
46 |
print(last_commit)
|
47 |
# save the current output to a file
|
48 |
df_current.to_parquet(f'output_{last_commit}.parquet', index=True)
|
49 |
print("Saved output to file")
|
50 |
+
if untracked_changes:
|
51 |
+
print("There are untracked changes")
|
52 |
+
else:
|
53 |
+
print("There are no untracked changes")
|
54 |
+
|
55 |
|