[IMP] script format: support format detected all repo
This commit is contained in:
parent
7a05cd29b8
commit
8ab3883b22
1 changed files with 73 additions and 45 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
# © 2021-2025 TechnoLibre (http://www.technolibre.ca)
|
# © 2021-2025 TechnoLibre (http://www.technolibre.ca)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
|
||||||
|
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
IGNORE_EXTENSION = []
|
IGNORE_EXTENSION = []
|
||||||
|
|
@ -15,17 +16,43 @@ def execute_shell(cmd):
|
||||||
|
|
||||||
def get_modified_files():
|
def get_modified_files():
|
||||||
lst_cmd_git_status = ["git", "status", "--porcelain"]
|
lst_cmd_git_status = ["git", "status", "--porcelain"]
|
||||||
print(" ".join(lst_cmd_git_status))
|
lst_cmd_git_status_repo = [
|
||||||
|
".venv.erplibre/bin/repo",
|
||||||
|
"forall",
|
||||||
|
"-p",
|
||||||
|
"-c",
|
||||||
|
"git status -s",
|
||||||
|
]
|
||||||
try:
|
try:
|
||||||
|
print(" ".join(lst_cmd_git_status))
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
lst_cmd_git_status,
|
lst_cmd_git_status,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
lines = result.stdout.strip().split("\n")
|
lines_local = result.stdout.strip().split("\n")
|
||||||
|
|
||||||
|
lst_lines = [(".", lines_local)]
|
||||||
|
|
||||||
|
print(" ".join(lst_cmd_git_status_repo))
|
||||||
|
|
||||||
|
result = subprocess.run(
|
||||||
|
lst_cmd_git_status_repo,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
lines_project = result.stdout.strip().split("\n\n")
|
||||||
|
for str_project_line in lines_project:
|
||||||
|
line_repo = str_project_line.split("\n")
|
||||||
|
projet_name = line_repo[0]
|
||||||
|
lines_local = line_repo[1:]
|
||||||
|
directory_project = projet_name[len("project ") :]
|
||||||
|
lst_lines.append((directory_project, lines_local))
|
||||||
|
|
||||||
modified_files = []
|
modified_files = []
|
||||||
|
for directory, lines in lst_lines:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
|
|
@ -51,6 +78,7 @@ def get_modified_files():
|
||||||
)
|
)
|
||||||
if has_space:
|
if has_space:
|
||||||
file_path = file_path_space
|
file_path = file_path_space
|
||||||
|
file_path = os.path.join(directory, file_path)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"'{line}'")
|
print(f"'{line}'")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue