mirror of https://github.com/mongodb/mongo
SERVER-105911: interface for single files bazel format (#43059)
GitOrigin-RevId: 1ffffc6f55bbf0a1006f66cd7f3da87bb05cffe3
This commit is contained in:
parent
d526f9ea73
commit
97b133d411
|
|
@ -181,6 +181,11 @@ def main() -> int:
|
||||||
help="The branch to use as the fork point for changed files",
|
help="The branch to use as the fork point for changed files",
|
||||||
default="origin/master",
|
default="origin/master",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--file",
|
||||||
|
help="The file to format",
|
||||||
|
type=pathlib.Path,
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
prettier_path: pathlib.Path = args.prettier.resolve()
|
prettier_path: pathlib.Path = args.prettier.resolve()
|
||||||
|
|
@ -188,7 +193,9 @@ def main() -> int:
|
||||||
os.chdir(default_dir)
|
os.chdir(default_dir)
|
||||||
|
|
||||||
files_to_format = "all"
|
files_to_format = "all"
|
||||||
if not args.all:
|
if args.file:
|
||||||
|
files_to_format = [str(args.file)]
|
||||||
|
elif not args.all:
|
||||||
max_distance = 100
|
max_distance = 100
|
||||||
distance = _git_distance([f"{args.origin_branch}..HEAD"])
|
distance = _git_distance([f"{args.origin_branch}..HEAD"])
|
||||||
if distance > max_distance:
|
if distance > max_distance:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue