@@ -4392,9 +4392,10 @@ let lock cli =
4392
4392
fixed and the same filter is on all dependencies that are added from \
4393
4393
them" ;
4394
4394
`P " - $(i,pin-depends) are kept and new ones are added if in the \
4395
- dependencies some packages are pinned " ;
4395
+ dependencies some packages are pinned" ;
4396
4396
`P " - pins are resolved: if a package is locally pinned, opam tries to get \
4397
- its remote url and branch, and sets this as the target URL" ;
4397
+ its remote url and branch, and sets this as the target URL; otherwise \
4398
+ it ignore them. You can use $(i,--keep-local) to keep the local url." ;
4398
4399
`S Manpage. s_arguments;
4399
4400
`S Manpage. s_options;
4400
4401
]
@@ -4404,7 +4405,11 @@ let lock cli =
4404
4405
" Only lock direct dependencies, rather than the whole dependency tree."
4405
4406
in
4406
4407
let lock_suffix = OpamArg. lock_suffix cli in
4407
- let lock global_options only_direct lock_suffix atom_locs () =
4408
+ let keep_local_flag =
4409
+ mk_flag ~cli (cli_from cli2_4) [" keep-local" ]
4410
+ " Do not discard local pins from pin-depends."
4411
+ in
4412
+ let lock global_options only_direct lock_suffix keep_local atom_locs () =
4408
4413
apply_global_options cli global_options;
4409
4414
OpamGlobalState. with_ `Lock_none @@ fun gt ->
4410
4415
OpamSwitchState. with_ `Lock_none gt @@ fun st ->
@@ -4420,7 +4425,9 @@ let lock cli =
4420
4425
let pkg_done =
4421
4426
OpamPackage.Set. fold (fun nv msgs ->
4422
4427
let opam = OpamSwitchState. opam st nv in
4423
- let locked = OpamLockCommand. lock_opam ~only_direct st opam in
4428
+ let locked =
4429
+ OpamLockCommand. lock_opam ~only_direct ~keep_local st opam
4430
+ in
4424
4431
let locked_fname =
4425
4432
OpamFilename. add_extension
4426
4433
(OpamFilename. of_string (OpamPackage. name_to_string nv))
@@ -4443,7 +4450,7 @@ let lock cli =
4443
4450
in
4444
4451
mk_command ~cli (cli_from cli2_1) " lock" ~doc ~man
4445
4452
Term. (const lock $ global_options cli $ only_direct_flag $ lock_suffix
4446
- $ atom_or_local_list)
4453
+ $ keep_local_flag $ atom_or_local_list)
4447
4454
4448
4455
(* HELP *)
4449
4456
let help =
0 commit comments