repo git: Add more debug lines for rebasing

This commit is contained in:
Hylke Bons 2013-07-06 20:00:27 +01:00
parent af2f7c58f7
commit 850395862b
2 changed files with 33 additions and 17 deletions

View file

@ -513,6 +513,7 @@ namespace SparkleLib.Git {
return false; return false;
} else { } else {
SparkleLogger.LogInfo ("", error_output);
SparkleLogger.LogInfo ("Git", Name + " | Conflict detected, trying to get out..."); SparkleLogger.LogInfo ("Git", Name + " | Conflict detected, trying to get out...");
while (Directory.Exists (rebase_apply_path) && HasLocalChanges) { while (Directory.Exists (rebase_apply_path) && HasLocalChanges) {
@ -584,12 +585,12 @@ namespace SparkleLib.Git {
continue; continue;
} }
SparkleLogger.LogInfo ("Git", Name + " | Resolving: " + 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") ||
line.StartsWith ("AU") || line.StartsWith ("UA")) { line.StartsWith ("AU") || line.StartsWith ("UA")) {
SparkleLogger.LogInfo ("Git", Name + " | Resolving: " + line);
// Recover local version // Recover local version
SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --theirs \"" + conflicting_path + "\""); SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --theirs \"" + conflicting_path + "\"");
git_theirs.StartAndWaitForExit (); git_theirs.StartAndWaitForExit ();
@ -615,7 +616,6 @@ namespace SparkleLib.Git {
// The local version has been modified, but the server version was removed // The local version has been modified, but the server version was removed
} else if (line.StartsWith ("DU")) { } else if (line.StartsWith ("DU")) {
SparkleLogger.LogInfo ("Git", Name + " | Resolving: " + line);
// The modified local version is already in the checkout, so it just needs to be added. // The modified local version is already in the checkout, so it just needs to be added.
// We need to specifically mention the file, so we can't reuse the Add () method // We need to specifically mention the file, so we can't reuse the Add () method
@ -624,8 +624,21 @@ namespace SparkleLib.Git {
changes_added = true; changes_added = true;
} else { // The server version has been modified, but the local version was removed
} else if (line.StartsWith ("UD")) {
// Recover server version
SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --ours \"" + conflicting_path + "\"");
git_theirs.StartAndWaitForExit ();
changes_added = true;
// Server and local versions were removed
} else if (line.StartsWith ("DD")) {
SparkleLogger.LogInfo ("Git", Name + " | No need to resolve: " + line); SparkleLogger.LogInfo ("Git", Name + " | No need to resolve: " + line);
// New local files
} else if (line.StartsWith ("??")) {
changes_added = true;
} }
} }
@ -693,18 +706,6 @@ namespace SparkleLib.Git {
} }
public override List<SparkleChangeSet> GetChangeSets (string path)
{
return GetChangeSetsInternal (path);
}
public override List<SparkleChangeSet> GetChangeSets ()
{
return GetChangeSetsInternal (null);
}
private bool FindError (string line) private bool FindError (string line)
{ {
Error = ErrorStatus.None; Error = ErrorStatus.None;
@ -738,6 +739,16 @@ namespace SparkleLib.Git {
} }
public override List<SparkleChangeSet> GetChangeSets ()
{
return GetChangeSetsInternal (null);
}
public override List<SparkleChangeSet> GetChangeSets (string path)
{
return GetChangeSetsInternal (path);
}
private List<SparkleChangeSet> GetChangeSetsInternal (string path) private List<SparkleChangeSet> GetChangeSetsInternal (string path)
{ {
List <SparkleChangeSet> change_sets = new List <SparkleChangeSet> (); List <SparkleChangeSet> change_sets = new List <SparkleChangeSet> ();

View file

@ -34,7 +34,12 @@ namespace SparkleLib {
public static void LogInfo (string type, string message, Exception exception) public static void LogInfo (string type, string message, Exception exception)
{ {
string timestamp = DateTime.Now.ToString ("HH:mm:ss"); string timestamp = DateTime.Now.ToString ("HH:mm:ss");
string line = timestamp + " | " + type + " | " + message; string line;
if (string.IsNullOrEmpty (type))
line = timestamp + " | " + message;
else
line = timestamp + " | " + type + " | " + message;
if (exception != null) if (exception != null)
line += ": " + exception.Message + " " + exception.StackTrace; line += ": " + exception.Message + " " + exception.StackTrace;