commit 39a0a968d6e5500090b72e22dd605b4fa5005a3c
parent 882c6a8b6bc8c644c7cc473ea26c9bdd0a5ac30e
Author: Michael Froman <mfroman@mozilla.com>
Date: Thu, 13 Nov 2025 18:37:45 +0000
Bug 2000029 - move detect_repo_type into run_operations for reuse. r=dbaker DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D272513
Diffstat:
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/dom/media/webrtc/third_party_build/restore_patch_stack.py b/dom/media/webrtc/third_party_build/restore_patch_stack.py
@@ -6,11 +6,17 @@ import os
import re
import shutil
import sys
-from enum import Enum, auto
from pathlib import Path
from fetch_github_repo import fetch_repo
-from run_operations import get_last_line, run_git, run_hg, run_shell
+from run_operations import (
+ RepoType,
+ detect_repo_type,
+ get_last_line,
+ run_git,
+ run_hg,
+ run_shell,
+)
# This script restores the mozilla patch stack and no-op commit tracking
# files. In the case of repo corruption or a mistake made during
@@ -19,19 +25,6 @@ from run_operations import get_last_line, run_git, run_hg, run_shell
# process from the beginning.
-class RepoType(Enum):
- HG = auto()
- GIT = auto()
-
-
-def detect_repo_type():
- if os.path.exists(".git"):
- return RepoType.GIT
- elif os.path.exists(".hg"):
- return RepoType.HG
- return None
-
-
def check_repo_status(repo_type):
if not isinstance(repo_type, RepoType):
print("check_repo_status requires type RepoType")
diff --git a/dom/media/webrtc/third_party_build/run_operations.py b/dom/media/webrtc/third_party_build/run_operations.py
@@ -4,6 +4,7 @@
import os
import subprocess
import sys
+from enum import Enum, auto
# This is a collection of helper functions that use the subprocess.run
# command to execute commands. In the future, if we have cases where
@@ -98,3 +99,16 @@ def update_resume_state(state, resume_state_filename):
with open(resume_state_filename, "w") as ofile:
ofile.write(state)
ofile.write("\n")
+
+
+class RepoType(Enum):
+ HG = auto()
+ GIT = auto()
+
+
+def detect_repo_type():
+ if os.path.exists(".git"):
+ return RepoType.GIT
+ elif os.path.exists(".hg"):
+ return RepoType.HG
+ return None