repo: Improve handling of offline repos. Fixes #439

This commit is contained in:
Hylke Bons 2011-12-03 12:40:03 +01:00
parent 6540b19ae2
commit 9a3e34381c
2 changed files with 11 additions and 6 deletions

View file

@ -137,10 +137,12 @@ namespace SparkleLib {
public override bool SyncUp ()
{
Add ();
if (AnyDifferences) {
Add ();
string message = FormatCommitMessage ();
Commit (message);
string message = FormatCommitMessage ();
Commit (message);
}
SparkleGit git = new SparkleGit (LocalPath, "push origin master");
git.Start ();

View file

@ -116,7 +116,7 @@ namespace SparkleLib {
// In the unlikely case that we haven't synced up our
// changes or the server was down, sync up again
if (HasUnsyncedChanges)
if (HasUnsyncedChanges && !IsSyncing && this.server_online)
SyncUpBase ();
};
@ -180,7 +180,7 @@ namespace SparkleLib {
}
public virtual bool CheckForRemoteChanges () // HasRemoteChanges { get; } ?
public virtual bool CheckForRemoteChanges () // TODO: HasRemoteChanges { get; }
{
return true;
}
@ -432,8 +432,9 @@ namespace SparkleLib {
HasUnsyncedChanges = true;
SyncDownBase ();
DisableWatching ();
if (SyncUp ()) {
if (this.server_online && SyncUp ()) {
HasUnsyncedChanges = false;
if (SyncStatusChanged != null)
@ -442,6 +443,8 @@ namespace SparkleLib {
this.listener.AnnounceBase (new SparkleAnnouncement (Identifier, CurrentRevision));
} else {
this.server_online = false;
if (SyncStatusChanged != null)
SyncStatusChanged (SyncStatus.Error);
}