This is true if the user has performed at least one checkout
action and is not waiting for a pending commit action.
Synchronize action
The Synchronize action brings a client??™s view of the repository up to date with
respect to the server. The practical effect of this is to set the version number of the
client to be equal to the repository??™s revision number.
partial static class User
{
static bool SynchronizeEnabled(string user)
{
return !CommitPending(user);
}
[Action]
static void Synchronize(string user)
{
int newVersion = Repository.currentRevision;
if (IsUser(user))
{
IdentifyConflicts(user, version[user]);
version = version.Override(user, newVersion);
}
else
Systems with Complex State 175
{
version = version.Add(user, newVersion);
revisions = revisions.Add(user, Map
.EmptyMap);
conflicts = conflicts.Add(user, Set.EmptySet);
}
}
Synchronize may occur at any time except when there is a pending commit action
for the given user. It is also possible to use Synchronize for a new user.
A Synchronize action may occur after some files have been edited but before they
have been committed to the repository. If the version of a file in the repository is
more recent (i.e., is larger) than the version already modified, then a conflict occurs.
The following method checks for such conflicts.
partial static class User
{
static void IdentifyConflicts(string user, int currentVersion)
{
Set userConflicts = conflicts[user];
foreach (Pair revision in revisions[user])
{
string file = revision.
Pages:
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245