versione con tab
This commit is contained in:
parent
2f820dc0af
commit
f61ac3f061
@ -2696,14 +2696,51 @@ def run_repository_transformation_async(
|
|||||||
"--force" # Necessario perché il repo non è un clone "fresco"
|
"--force" # Necessario perché il repo non è un clone "fresco"
|
||||||
]
|
]
|
||||||
|
|
||||||
git_commands.log_and_execute(
|
# Use a streaming execution so we can log progress lines as they arrive.
|
||||||
|
log_handler.log_info(f"[Worker] Running git-filter-repo (this may take a while)...", func_name=func_name)
|
||||||
|
try:
|
||||||
|
# Prepare startupinfo for Windows to hide console if possible
|
||||||
|
startupinfo = None
|
||||||
|
creationflags = 0
|
||||||
|
if os.name == 'nt':
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
||||||
|
proc = subprocess.Popen(
|
||||||
filter_repo_command,
|
filter_repo_command,
|
||||||
working_directory=source_repo_path,
|
cwd=source_repo_path,
|
||||||
check=True,
|
stdout=subprocess.PIPE,
|
||||||
log_output_level=logging.INFO
|
stderr=subprocess.STDOUT,
|
||||||
|
text=True,
|
||||||
|
encoding='utf-8',
|
||||||
|
errors='replace',
|
||||||
|
startupinfo=startupinfo,
|
||||||
|
creationflags=creationflags,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
aggregated_lines = []
|
||||||
|
if proc.stdout:
|
||||||
|
for raw_line in proc.stdout:
|
||||||
|
line = raw_line.rstrip('\n')
|
||||||
|
aggregated_lines.append(line)
|
||||||
|
# Log each line so the UI log shows live progress
|
||||||
|
try:
|
||||||
|
log_handler.log_message(logging.INFO, f"[git-filter-repo] {line}", func_name=func_name)
|
||||||
|
except Exception:
|
||||||
|
# Logging must not break the worker; ignore logging errors
|
||||||
|
pass
|
||||||
|
|
||||||
|
ret = proc.wait()
|
||||||
|
if ret != 0:
|
||||||
|
full_output = "\n".join(aggregated_lines)
|
||||||
|
raise GitCommandError(f"git-filter-repo failed with exit code {ret}", command=filter_repo_command, stderr=full_output)
|
||||||
|
|
||||||
log_handler.log_info(f"[Worker] History rewritten successfully.", func_name=func_name)
|
log_handler.log_info(f"[Worker] History rewritten successfully.", func_name=func_name)
|
||||||
|
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
raise GitCommandError("git-filter-repo not found. Ensure it is installed and in PATH.", command=filter_repo_command) from e
|
||||||
|
|
||||||
# --- Passo 2: Rimuovere il remote 'origin' esistente (git-filter-repo lo fa già) ---
|
# --- Passo 2: Rimuovere il remote 'origin' esistente (git-filter-repo lo fa già) ---
|
||||||
log_handler.log_info(f"[Worker] Step 2: Verifying old remotes are removed (git-filter-repo should handle this)...", func_name=func_name)
|
log_handler.log_info(f"[Worker] Step 2: Verifying old remotes are removed (git-filter-repo should handle this)...", func_name=func_name)
|
||||||
# Non è strettamente necessario, ma è una buona pratica assicurarsene
|
# Non è strettamente necessario, ma è una buona pratica assicurarsene
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user