Remote last bits of Git# code and comment out broken conflict resolution code

This commit is contained in:
Hylke Bons 2011-04-21 15:46:46 +02:00
parent 739f06b37b
commit 780ed8e751

View file

@ -22,13 +22,12 @@ using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Timers; using System.Timers;
using GitSharp;
using Meebey.SmartIrc4net; using Meebey.SmartIrc4net;
using Mono.Unix; using Mono.Unix;
namespace SparkleLib { namespace SparkleLib {
public class SparkleRepo : Repository { public class SparkleRepo {
private Timer RemoteTimer; private Timer RemoteTimer;
private Timer LocalTimer; private Timer LocalTimer;
@ -113,7 +112,7 @@ namespace SparkleLib {
public delegate void FetchingFinishedEventHandler (object o, SparkleEventArgs args); public delegate void FetchingFinishedEventHandler (object o, SparkleEventArgs args);
public delegate void FetchingFailedEventHandler (object o, SparkleEventArgs args); public delegate void FetchingFailedEventHandler (object o, SparkleEventArgs args);
public delegate void NewCommitEventHandler (SparkleCommit commit, string repository_path); public delegate void NewCommitEventHandler (SparkleCommit commit, string repository_path);
public delegate void ConflictDetectedEventHandler (object o, SparkleEventArgs args); // public delegate void ConflictDetectedEventHandler (object o, SparkleEventArgs args);
public delegate void ChangesDetectedEventHandler (object o, SparkleEventArgs args); public delegate void ChangesDetectedEventHandler (object o, SparkleEventArgs args);
public delegate void CommitEndedUpEmptyEventHandler (object o, SparkleEventArgs args); public delegate void CommitEndedUpEmptyEventHandler (object o, SparkleEventArgs args);
@ -126,12 +125,12 @@ namespace SparkleLib {
public event FetchingFinishedEventHandler FetchingFinished; public event FetchingFinishedEventHandler FetchingFinished;
public event FetchingFailedEventHandler FetchingFailed; public event FetchingFailedEventHandler FetchingFailed;
public event NewCommitEventHandler NewCommit; public event NewCommitEventHandler NewCommit;
public event ConflictDetectedEventHandler ConflictDetected; // public event ConflictDetectedEventHandler ConflictDetected;
public event ChangesDetectedEventHandler ChangesDetected; public event ChangesDetectedEventHandler ChangesDetected;
public event CommitEndedUpEmptyEventHandler CommitEndedUpEmpty; public event CommitEndedUpEmptyEventHandler CommitEndedUpEmpty;
public SparkleRepo (string path) : base (path) public SparkleRepo (string path)
{ {
LocalPath = path; LocalPath = path;
Name = Path.GetFileName (LocalPath); Name = Path.GetFileName (LocalPath);
@ -144,9 +143,9 @@ namespace SparkleLib {
UserEmail = GetUserEmail (); UserEmail = GetUserEmail ();
// TODO: replace this with a check on the number of objects in .git/objects/ (empty if 2) // TODO: replace this with a check on the number of objects in .git/objects/ (empty if 2)
if (Head.CurrentCommit == null) // if (Head.CurrentCommit == null)
_CurrentHash = null; // _CurrentHash = null;
else // else
_CurrentHash = GetCurrentHash (); _CurrentHash = GetCurrentHash ();
_IsSyncing = false; _IsSyncing = false;
@ -347,11 +346,8 @@ namespace SparkleLib {
return; return;
WatcherChangeTypes wct = fse_args.ChangeType; WatcherChangeTypes wct = fse_args.ChangeType;
int number_of_changes = Status.Untracked.Count +
Status.Missing.Count +
Status.Modified.Count;
if (number_of_changes > 0) { if (AnyDifferences) {
_IsBuffering = true; _IsBuffering = true;
// Only fire the event if the timer has been stopped. // Only fire the event if the timer has been stopped.
@ -418,12 +414,15 @@ namespace SparkleLib {
git.Start (); git.Start ();
git.WaitForExit (); git.WaitForExit ();
string output = git.StandardOutput.ReadToEnd ().Trim (); string output = git.StandardOutput.ReadToEnd ().TrimEnd ();
string [] lines = output.Split ("\n".ToCharArray ());
if (output.Length > 0)
return true; foreach (string line in lines) {
else if (line.Length > 1 &&!line [1].Equals (" "))
return false; return true;
}
return false;
} }
} }
@ -472,7 +471,7 @@ namespace SparkleLib {
// Commits the made changes // Commits the made changes
new public void Commit (string message) public void Commit (string message)
{ {
if (!AnyDifferences) if (!AnyDifferences)
return; return;
@ -558,7 +557,7 @@ namespace SparkleLib {
SparkleGit git = new SparkleGit (LocalPath, "rebase -v FETCH_HEAD"); SparkleGit git = new SparkleGit (LocalPath, "rebase -v FETCH_HEAD");
git.Exited += delegate { git.Exited += delegate {
if (Status.MergeConflict.Count > 0) { /* if (Status.MergeConflict.Count > 0) {
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict detected..."); SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict detected...");
foreach (string problem_file_name in Status.MergeConflict) { foreach (string problem_file_name in Status.MergeConflict) {
@ -590,9 +589,10 @@ namespace SparkleLib {
git_continue.WaitForExit (); git_continue.WaitForExit ();
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict resolved."); SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict resolved.");
*/
Push (); _CurrentHash = GetCurrentHash ();
} // Push ();
// }
}; };
git.Start (); git.Start ();
@ -893,7 +893,7 @@ namespace SparkleLib {
// Reading the standard output HAS to go before // Reading the standard output HAS to go before
// WaitForExit, or it will hang forever on output > 4096 bytes // WaitForExit, or it will hang forever on output > 4096 bytes
string output = git_status.StandardOutput.ReadToEnd (); string output = git_status.StandardOutput.ReadToEnd ().Trim ("\n".ToCharArray ());
git_status.WaitForExit (); git_status.WaitForExit ();
string [] lines = output.Split ("\n".ToCharArray ()); string [] lines = output.Split ("\n".ToCharArray ());
@ -960,12 +960,11 @@ namespace SparkleLib {
// Disposes all resourses of this object // Disposes all resourses of this object
new public void Dispose () public void Dispose ()
{ {
RemoteTimer.Dispose (); RemoteTimer.Dispose ();
LocalTimer.Dispose (); LocalTimer.Dispose ();
Listener.Dispose (); Listener.Dispose ();
//base.Dispose ();
} }
} }
} }