Remove(user);
IdentifyConflicts(user, version[user]);
version = version.Override(user, Repository.currentRevision);
}
}
}
Resolve action
The Resolve action reconciles differences between a local edited version of a file
and a parallel update on the server. Of course, in the model we don??™t deal with the
actual contents of the file; instead, we examine the conditions that must occur in
order for the resolve operation to occur.
partial static class User
{
static bool ResolveEnabled(string user, string file)
{
return (CanStep(user) && conflicts[user].Contains(file));
}
[Action]
static void Resolve([Domain("Users")] string user, string file)
{
Set
remainingFiles = conflicts[user].Remove(file);
conflicts = conflicts.Override(user, remainingFiles);
}
}
180 Modeling Systems with Structured State
CommitComplete action
If a Commit action is pending and there are no conflicts, then the repository is able
to incorporate the proposed changes. The successful update is represented by the
CommitComplete action.
partial static class User
{
static Set NextVersion()
{
return new Set(Repository.currentRevision,
Repository.currentRevision + 1);
}
static bool CommitCompleteEnabled(string user, int newVersion)
{
return IsUser(user) && CommitPending(user)
&& conflicts[user].IsEmpty
&& newVersion == (revisions[user].IsEmpty
? Repository.
Pages:
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249