ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib/protos/working_copy.proto
Martin von Zweigbergk 38180555de working_copy: keep track of operation ID (#13)
When there are concurrent operations that want to update the working
copy, it's useful to know which operation was the last to successfully
update the working copy. That can help use decide how to resolve a
mismatch between the repo view's record and the working copy's
record. If we detect such a difference, we can look at the working
copy's operation ID to see if it was updated by an operation before or
after we loaded the repo.

If the working copy's record says that it was updated at operation A
and we have loaded the repo at operation B (after A), we know that the
working copy is stale, so we can automatically update it (or tell the
user to run some command to update it if we think that's more
user-friendly).

Conversely, if we have loaded the repo at operation A and the working
copy's record says that it was updated at operation B, we know that
there was some concurrent operation that updated it. We can then
decide to print a warning telling the user that we skipped updating
because of the conflict. We already have logic for not updating the
working copy if the repo is loaded at an earlier operation, but maybe
we can drop that if we record the operation in the working copy (as
this patch does).
2022-01-19 19:15:29 -08:00

44 lines
1.2 KiB
Protocol Buffer

// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
enum FileType {
Normal = 0;
Symlink = 1;
Executable = 2;
Conflict = 3;
}
message FileState {
uint64 mtime_millis_since_epoch = 1;
uint64 size = 2;
FileType file_type = 3;
// Set only if file_type is Conflict
bytes conflict_id = 4;
}
message TreeState {
bytes tree_id = 1;
map<string, FileState> file_states = 2;
}
message Checkout {
// The operation at which the working copy was updated.
bytes operation_id = 2;
// The checked-out commit, which can be viewed as a cache of the checkout
// recorded in `operation_id`'s operation.
bytes commit_id = 1;
}