repo: Improve handling of offline repos. Fixes #439
This commit is contained in:
parent
6540b19ae2
commit
9a3e34381c
|
@ -137,10 +137,12 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public override bool SyncUp ()
|
public override bool SyncUp ()
|
||||||
{
|
{
|
||||||
Add ();
|
if (AnyDifferences) {
|
||||||
|
Add ();
|
||||||
|
|
||||||
string message = FormatCommitMessage ();
|
string message = FormatCommitMessage ();
|
||||||
Commit (message);
|
Commit (message);
|
||||||
|
}
|
||||||
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "push origin master");
|
SparkleGit git = new SparkleGit (LocalPath, "push origin master");
|
||||||
git.Start ();
|
git.Start ();
|
||||||
|
|
|
@ -116,7 +116,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
// In the unlikely case that we haven't synced up our
|
// In the unlikely case that we haven't synced up our
|
||||||
// changes or the server was down, sync up again
|
// changes or the server was down, sync up again
|
||||||
if (HasUnsyncedChanges)
|
if (HasUnsyncedChanges && !IsSyncing && this.server_online)
|
||||||
SyncUpBase ();
|
SyncUpBase ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual bool CheckForRemoteChanges () // HasRemoteChanges { get; } ?
|
public virtual bool CheckForRemoteChanges () // TODO: HasRemoteChanges { get; }
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -432,8 +432,9 @@ namespace SparkleLib {
|
||||||
|
|
||||||
HasUnsyncedChanges = true;
|
HasUnsyncedChanges = true;
|
||||||
SyncDownBase ();
|
SyncDownBase ();
|
||||||
|
DisableWatching ();
|
||||||
|
|
||||||
if (SyncUp ()) {
|
if (this.server_online && SyncUp ()) {
|
||||||
HasUnsyncedChanges = false;
|
HasUnsyncedChanges = false;
|
||||||
|
|
||||||
if (SyncStatusChanged != null)
|
if (SyncStatusChanged != null)
|
||||||
|
@ -442,6 +443,8 @@ namespace SparkleLib {
|
||||||
this.listener.AnnounceBase (new SparkleAnnouncement (Identifier, CurrentRevision));
|
this.listener.AnnounceBase (new SparkleAnnouncement (Identifier, CurrentRevision));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
this.server_online = false;
|
||||||
|
|
||||||
if (SyncStatusChanged != null)
|
if (SyncStatusChanged != null)
|
||||||
SyncStatusChanged (SyncStatus.Error);
|
SyncStatusChanged (SyncStatus.Error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue