SERVER-105911: interface for single files bazel format (#43059)

GitOrigin-RevId: 1ffffc6f55bbf0a1006f66cd7f3da87bb05cffe3
This commit is contained in:
Udita 2025-10-29 15:18:07 -04:00 committed by MongoDB Bot
parent d526f9ea73
commit 97b133d411
1 changed files with 8 additions and 1 deletions

View File

@ -181,6 +181,11 @@ def main() -> int:
help="The branch to use as the fork point for changed files",
default="origin/master",
)
parser.add_argument(
"--file",
help="The file to format",
type=pathlib.Path,
)
args = parser.parse_args()
prettier_path: pathlib.Path = args.prettier.resolve()
@ -188,7 +193,9 @@ def main() -> int:
os.chdir(default_dir)
files_to_format = "all"
if not args.all:
if args.file:
files_to_format = [str(args.file)]
elif not args.all:
max_distance = 100
distance = _git_distance([f"{args.origin_branch}..HEAD"])
if distance > max_distance: