+if (-f "$mainrepo/inbox.lock") {
+ if (!defined $version) {
+ $version = 2;
+ } elsif ($version != 2) {
+ die "$mainrepo is a -V2 repo, -V$version specified\n"
+ }
+} elsif (-d "$mainrepo/objects") {
+ if (!defined $version) {
+ $version = 1;
+ } elsif ($version != 1) {
+ die "$mainrepo is a -V1 repo, -V$version specified\n"
+ }
+}
+
+$version = 1 unless defined $version;