lib: add folder name to debug info for each git call. Closes #796
This commit is contained in:
parent
61ad8c77a1
commit
4a6a0c5dbb
|
@ -48,7 +48,8 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
new public void Start ()
|
new public void Start ()
|
||||||
{
|
{
|
||||||
SparkleHelpers.DebugInfo ("Cmd", "git " + StartInfo.Arguments);
|
SparkleHelpers.DebugInfo ("Cmd | " + System.IO.Path.GetFileName (StartInfo.WorkingDirectory),
|
||||||
|
"git " + StartInfo.Arguments);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
base.Start ();
|
base.Start ();
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
public override bool HasRemoteChanges {
|
public override bool HasRemoteChanges {
|
||||||
get {
|
get {
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Checking for remote changes...");
|
SparkleHelpers.DebugInfo ("Git", Name + " | Checking for remote changes...");
|
||||||
|
|
||||||
string current_revision = CurrentRevision;
|
string current_revision = CurrentRevision;
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "ls-remote --exit-code \"" + RemoteUrl + "\" master");
|
SparkleGit git = new SparkleGit (LocalPath, "ls-remote --exit-code \"" + RemoteUrl + "\" master");
|
||||||
|
@ -162,14 +162,14 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
if (!remote_revision.StartsWith (current_revision)) {
|
if (!remote_revision.StartsWith (current_revision)) {
|
||||||
SparkleHelpers.DebugInfo ("Git",
|
SparkleHelpers.DebugInfo ("Git",
|
||||||
"[" + Name + "] Remote changes detected (local: " +
|
Name + " | Remote changes detected (local: " +
|
||||||
current_revision + ", remote: " + remote_revision + ")");
|
current_revision + ", remote: " + remote_revision + ")");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SparkleHelpers.DebugInfo ("Git",
|
SparkleHelpers.DebugInfo ("Git",
|
||||||
"[" + Name + "] No remote changes detected (local+remote: " + current_revision + ")");
|
Name + " | No remote changes detected (local+remote: " + current_revision + ")");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] " + line);
|
SparkleHelpers.DebugInfo ("Git", Name + " | " + line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number >= percentage) {
|
if (number >= percentage) {
|
||||||
|
@ -293,7 +293,7 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] " + line);
|
SparkleHelpers.DebugInfo ("Git", Name + " | " + line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ namespace SparkleLib.Git {
|
||||||
git.Start ();
|
git.Start ();
|
||||||
git.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes staged");
|
SparkleHelpers.DebugInfo ("Git", Name + " | Changes staged");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ namespace SparkleLib.Git {
|
||||||
git.StandardOutput.ReadToEnd ();
|
git.StandardOutput.ReadToEnd ();
|
||||||
git.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Commit", "[" + Name + "] " + message);
|
SparkleHelpers.DebugInfo ("Commit", Name + " | " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,12 +417,12 @@ namespace SparkleLib.Git {
|
||||||
git.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
if (git.ExitCode != 0) {
|
if (git.ExitCode != 0) {
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict detected, trying to get out...");
|
SparkleHelpers.DebugInfo ("Git", Name + " | Conflict detected, trying to get out...");
|
||||||
|
|
||||||
while (HasLocalChanges)
|
while (HasLocalChanges)
|
||||||
ResolveConflict ();
|
ResolveConflict ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict resolved");
|
SparkleHelpers.DebugInfo ("Git", Name + " | Conflict resolved");
|
||||||
OnConflictResolved ();
|
OnConflictResolved ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ namespace SparkleLib.Git {
|
||||||
string conflicting_path = line.Substring (3);
|
string conflicting_path = line.Substring (3);
|
||||||
conflicting_path = conflicting_path.Trim ("\"".ToCharArray ());
|
conflicting_path = conflicting_path.Trim ("\"".ToCharArray ());
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict type: " + line);
|
SparkleHelpers.DebugInfo ("Git", Name + " | Conflict type: " + line);
|
||||||
|
|
||||||
// Both the local and server version have been modified
|
// Both the local and server version have been modified
|
||||||
if (line.StartsWith ("UU") || line.StartsWith ("AA") ||
|
if (line.StartsWith ("UU") || line.StartsWith ("AA") ||
|
||||||
|
@ -735,7 +735,7 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
if (File.Exists (HEAD_file_path)) {
|
if (File.Exists (HEAD_file_path)) {
|
||||||
File.Move (HEAD_file_path, HEAD_file_path + ".backup");
|
File.Move (HEAD_file_path, HEAD_file_path + ".backup");
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Renamed " + HEAD_file_path);
|
SparkleHelpers.DebugInfo ("Git", Name + " | Renamed " + HEAD_file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -753,7 +753,7 @@ namespace SparkleLib.Git {
|
||||||
File.WriteAllText (Path.Combine (path, ".empty"), "I'm a folder!");
|
File.WriteAllText (Path.Combine (path, ".empty"), "I'm a folder!");
|
||||||
File.SetAttributes (Path.Combine (path, ".empty"), FileAttributes.Hidden);
|
File.SetAttributes (Path.Combine (path, ".empty"), FileAttributes.Hidden);
|
||||||
} catch {
|
} catch {
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Failed adding empty folder " + path);
|
SparkleHelpers.DebugInfo ("Git", Name + " | Failed adding empty folder " + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,8 @@ namespace SparkleLib {
|
||||||
// Show debug info if needed
|
// Show debug info if needed
|
||||||
public static void DebugInfo (string type, string message)
|
public static void DebugInfo (string type, string message)
|
||||||
{
|
{
|
||||||
if (!message.StartsWith ("["))
|
|
||||||
message = " " + message;
|
|
||||||
|
|
||||||
string timestamp = DateTime.Now.ToString ("HH:mm:ss");
|
string timestamp = DateTime.Now.ToString ("HH:mm:ss");
|
||||||
string line = timestamp + " " + "[" + type + "]" + message;
|
string line = timestamp + " | " + type + " | " + message;
|
||||||
|
|
||||||
if (SparkleConfig.DebugMode)
|
if (SparkleConfig.DebugMode)
|
||||||
Console.WriteLine (line);
|
Console.WriteLine (line);
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace SparkleLib {
|
||||||
File.WriteAllText (id_path, this.identifier);
|
File.WriteAllText (id_path, this.identifier);
|
||||||
File.SetAttributes (id_path, FileAttributes.Hidden);
|
File.SetAttributes (id_path, FileAttributes.Hidden);
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Local", "[" + Name + "] Assigned identifier: " + this.identifier);
|
SparkleHelpers.DebugInfo ("Local", Name + " | Assigned identifier: " + this.identifier);
|
||||||
|
|
||||||
return this.identifier;
|
return this.identifier;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ namespace SparkleLib {
|
||||||
this.watcher.Disable ();
|
this.watcher.Disable ();
|
||||||
this.remote_timer.Stop ();
|
this.remote_timer.Stop ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Local", "[" + Name + "] Activity detected, waiting for it to settle...");
|
SparkleHelpers.DebugInfo ("Local", Name + " | Activity detected, waiting for it to settle...");
|
||||||
|
|
||||||
if (ChangesDetected != null)
|
if (ChangesDetected != null)
|
||||||
ChangesDetected ();
|
ChangesDetected ();
|
||||||
|
@ -260,7 +260,7 @@ namespace SparkleLib {
|
||||||
size_buffer [1].Equals (size_buffer [2]) &&
|
size_buffer [1].Equals (size_buffer [2]) &&
|
||||||
size_buffer [2].Equals (size_buffer [3])) {
|
size_buffer [2].Equals (size_buffer [3])) {
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Local", "[" + Name + "] Activity has settled");
|
SparkleHelpers.DebugInfo ("Local", Name + " | Activity has settled");
|
||||||
IsBuffering = false;
|
IsBuffering = false;
|
||||||
|
|
||||||
this.watcher.Disable ();
|
this.watcher.Disable ();
|
||||||
|
@ -291,13 +291,13 @@ namespace SparkleLib {
|
||||||
this.watcher.Disable ();
|
this.watcher.Disable ();
|
||||||
this.remote_timer.Stop ();
|
this.remote_timer.Stop ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("SyncUp", "[" + Name + "] Initiated");
|
SparkleHelpers.DebugInfo ("SyncUp", Name + " | Initiated");
|
||||||
|
|
||||||
if (SyncStatusChanged != null)
|
if (SyncStatusChanged != null)
|
||||||
SyncStatusChanged (SyncStatus.SyncUp);
|
SyncStatusChanged (SyncStatus.SyncUp);
|
||||||
|
|
||||||
if (SyncUp ()) {
|
if (SyncUp ()) {
|
||||||
SparkleHelpers.DebugInfo ("SyncUp", "[" + Name + "] Done");
|
SparkleHelpers.DebugInfo ("SyncUp", Name + " | Done");
|
||||||
|
|
||||||
HasUnsyncedChanges = false;
|
HasUnsyncedChanges = false;
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ namespace SparkleLib {
|
||||||
this.listener.Announce (new SparkleAnnouncement (Identifier, CurrentRevision));
|
this.listener.Announce (new SparkleAnnouncement (Identifier, CurrentRevision));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SparkleHelpers.DebugInfo ("SyncUp", "[" + Name + "] Error");
|
SparkleHelpers.DebugInfo ("SyncUp", Name + " | Error");
|
||||||
|
|
||||||
HasUnsyncedChanges = true;
|
HasUnsyncedChanges = true;
|
||||||
SyncDownBase ();
|
SyncDownBase ();
|
||||||
|
@ -341,7 +341,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
private void SyncDownBase ()
|
private void SyncDownBase ()
|
||||||
{
|
{
|
||||||
SparkleHelpers.DebugInfo ("SyncDown", "[" + Name + "] Initiated");
|
SparkleHelpers.DebugInfo ("SyncDown", Name + " | Initiated");
|
||||||
this.remote_timer.Stop ();
|
this.remote_timer.Stop ();
|
||||||
this.watcher.Disable ();
|
this.watcher.Disable ();
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ namespace SparkleLib {
|
||||||
string pre_sync_revision = CurrentRevision;
|
string pre_sync_revision = CurrentRevision;
|
||||||
|
|
||||||
if (SyncDown ()) {
|
if (SyncDown ()) {
|
||||||
SparkleHelpers.DebugInfo ("SyncDown", "[" + Name + "] Done");
|
SparkleHelpers.DebugInfo ("SyncDown", Name + " | Done");
|
||||||
ServerOnline = true;
|
ServerOnline = true;
|
||||||
|
|
||||||
if (!pre_sync_revision.Equals (CurrentRevision)) {
|
if (!pre_sync_revision.Equals (CurrentRevision)) {
|
||||||
|
@ -383,7 +383,7 @@ namespace SparkleLib {
|
||||||
SyncStatusChanged (SyncStatus.Idle);
|
SyncStatusChanged (SyncStatus.Idle);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SparkleHelpers.DebugInfo ("SyncDown", "[" + Name + "] Error");
|
SparkleHelpers.DebugInfo ("SyncDown", Name + " | Error");
|
||||||
ServerOnline = false;
|
ServerOnline = false;
|
||||||
|
|
||||||
if (SyncStatusChanged != null)
|
if (SyncStatusChanged != null)
|
||||||
|
|
Loading…
Reference in a new issue