@@ -1157,7 +1157,20 @@ let from_2_2_beta_to_2_2 ~on_the_fly:_ _ conf = conf, gtc_none
1157
1157
1158
1158
let latest_version = OpamFile.Config. root_version
1159
1159
1160
- (* Note to dev: try as possible to not change that value *)
1160
+ (* Development notes:
1161
+ opam differentiates two kinds of format upgrade - "Hard" upgrades, which
1162
+ must be written straight to disk, and "Light" upgrades, which can be
1163
+ performed in-memory, and don't have to be written immediately.
1164
+ This distinction was added in opam 2.1, as it allows users of a _newer_
1165
+ version of opam-state to _read_ an opam root which is still being maintained
1166
+ by an _older_ version of opam (for example, it allows a program compiled with
1167
+ opam-state 2.1.0 to load the global configuration of an opam 2.0 user's root
1168
+ without forcing the upgrade of that root to 2.1).
1169
+
1170
+ Essentially, a "Hard" upgrade is used where the change is difficult (or even
1171
+ impossible) to perform in-memory. We try our hardest to keep all format
1172
+ upgrades "Light" - i.e. the aim is that this version below should never
1173
+ change. *)
1161
1174
let latest_hard_upgrade = (* to *) v2_0_beta5
1162
1175
1163
1176
(* intermediate roots that need a hard upgrade when upgrading from them *)
@@ -1360,14 +1373,16 @@ let as_necessary_repo_switch_t updates changes read_f lock_kind gt =
1360
1373
(* If we don't have a written opam root version in a config file,
1361
1374
we are unable to determine if there is an upgrade to do. This can happen in
1362
1375
case there is only on the fly upgrades from 2.0. Should we fail ? *)
1363
- let written_root_version = OpamFile.Config. raw_root_version config_f
1376
+ let written_root_version =
1377
+ OpamFile.Config. raw_root_version config_f
1364
1378
in
1365
1379
(* Config already upgraded *)
1366
- if OpamStd.Option. equal OpamVersion. equal
1367
- written_root_version
1368
- (Some OpamFile.Config. root_version) then None else
1380
+ if OpamStd.Option. equal_some OpamVersion. equal
1381
+ OpamFile.Config. root_version written_root_version then
1382
+ None
1383
+ else
1369
1384
let written_root_version =
1370
- OpamStd.Option. default v2_0 written_root_version
1385
+ OpamStd.Option. default OpamFile.Config. default_old_root_version written_root_version
1371
1386
in
1372
1387
let updates =
1373
1388
List. filter (fun (v ,_ ) ->
0 commit comments